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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/scss/components/additional-information-table.scss +9 -0
  2. package/dist/scss/components/breadcrumb.scss +32 -0
  3. package/dist/scss/components/dataset-downloads.scss +0 -0
  4. package/dist/scss/components/dataset-search-facets.scss +10 -0
  5. package/dist/scss/components/dataset-search-list-item.scss +20 -0
  6. package/dist/scss/components/dataset-tags.scss +4 -0
  7. package/dist/scss/components/datatable.scss +24 -0
  8. package/dist/scss/components/index.scss +9 -0
  9. package/dist/scss/components/pagination.scss +59 -0
  10. package/dist/scss/components/resource-information-table.scss +5 -0
  11. package/dist/scss/index.scss +24 -0
  12. package/dist/scss/templates/dataset-search.scss +38 -0
  13. package/dist/scss/templates/dataset.scss +44 -0
  14. package/dist/scss/templates/filtered-resource.scss +19 -0
  15. package/dist/scss/templates/footer.scss +83 -0
  16. package/dist/scss/templates/header.scss +402 -0
  17. package/dist/scss/templates/index.scss +7 -0
  18. package/dist/scss/templates/query-builder.scss +22 -0
  19. package/dist/scss/templates/swagger.scss +21 -0
  20. package/lib/assets/frequencyMap.js +22 -0
  21. package/lib/assets/icons/close.js +33 -0
  22. package/lib/assets/icons/close.jsx +24 -0
  23. package/lib/assets/icons/copy.js +33 -0
  24. package/lib/assets/icons/copy.jsx +23 -0
  25. package/lib/assets/icons/download.js +33 -0
  26. package/lib/assets/icons/download.jsx +23 -0
  27. package/lib/assets/icons/settings.js +34 -0
  28. package/lib/assets/icons/settings.jsx +24 -0
  29. package/lib/assets/metadataMapping.js +161 -0
  30. package/lib/assets/metadataMapping.jsx +110 -0
  31. package/lib/commands/index.js +7 -0
  32. package/lib/commands/templates/footer.js +61 -0
  33. package/lib/commands/templates/header.js +84 -0
  34. package/lib/commands/templates/page_not_found.js +14 -0
  35. package/lib/components/ApiDocumentation/index.js +24 -0
  36. package/lib/components/Breadcrumb/index.js +47 -0
  37. package/lib/components/DataTableDensity/datatabledensity.test.js +30 -0
  38. package/lib/components/DataTableDensity/index.js +47 -0
  39. package/lib/components/DataTableRowChanger/datatablerowchanger.test.js +49 -0
  40. package/lib/components/DataTableRowChanger/index.js +46 -0
  41. package/lib/components/DatasetAdditionalInformation/index.js +59 -0
  42. package/lib/components/DatasetDownloads/datasetdownloads.test.js +30 -0
  43. package/lib/components/DatasetDownloads/index.js +34 -0
  44. package/lib/components/DatasetSearchFacets/dataset_search_facets.test.js +103 -0
  45. package/lib/components/DatasetSearchFacets/index.js +104 -0
  46. package/lib/components/DatasetSearchListItem/datasetsearchlistitem.test.js +44 -0
  47. package/lib/components/DatasetSearchListItem/index.js +86 -0
  48. package/lib/components/DatasetTags/datasettags.test.js +40 -0
  49. package/lib/components/DatasetTags/index.js +38 -0
  50. package/lib/components/Hero/index.js +92 -0
  51. package/lib/components/ManageColumns/index.js +36 -0
  52. package/lib/components/NavBar/index.js +55 -0
  53. package/lib/components/NavLink/index.js +60 -0
  54. package/lib/components/NavLink/navlink.test.js +35 -0
  55. package/lib/components/Pagination/index.js +263 -0
  56. package/lib/components/Pagination/pagination.test.js +541 -0
  57. package/lib/components/ResourceConditionField/ResourceConditionalField.test.js +20 -0
  58. package/lib/components/ResourceConditionField/index.js +246 -0
  59. package/lib/components/ResourceFilter/index.js +174 -0
  60. package/lib/components/ResourceFilter/resourcefilter.test.js +440 -0
  61. package/lib/components/ResourceFooter/index.js +34 -0
  62. package/lib/components/ResourceHeader/index.js +149 -0
  63. package/lib/components/ResourceInformation/index.js +37 -0
  64. package/lib/components/ResourcePreview/index.js +139 -0
  65. package/lib/components/SearchModal/index.js +116 -0
  66. package/lib/components/SubMenu/index.js +86 -0
  67. package/lib/components/TransformedDate/index.js +34 -0
  68. package/lib/components/useAddLoginLink/index.js +44 -0
  69. package/lib/components/useScrollToTop/index.js +22 -0
  70. package/lib/index.js +247 -0
  71. package/lib/templates/APIPage/index.js +30 -0
  72. package/lib/templates/Dataset/DatasetBody.js +189 -0
  73. package/lib/templates/Dataset/index.js +83 -0
  74. package/lib/templates/DatasetSearch/datasetsearch.test.js +122 -0
  75. package/lib/templates/DatasetSearch/index.js +356 -0
  76. package/lib/templates/DrupalPage/index.js +37 -0
  77. package/lib/templates/FilteredResource/FilteredResourceBody.js +160 -0
  78. package/lib/templates/FilteredResource/QueryBuilder.js +235 -0
  79. package/lib/templates/FilteredResource/QueryRow.js +175 -0
  80. package/lib/templates/FilteredResource/QueryTitle.js +89 -0
  81. package/lib/templates/FilteredResource/functions.js +142 -0
  82. package/lib/templates/FilteredResource/index.js +95 -0
  83. package/lib/templates/Footer/footer.test.js +48 -0
  84. package/lib/templates/Footer/index.js +366 -0
  85. package/lib/templates/PageNotFound/index.js +25 -0
  86. package/lib/templates/header/index.js +112 -0
  87. package/lib/templates/mobile_header/index.js +199 -0
  88. package/package.json +11 -7
  89. package/dist/main.css +0 -679
  90. package/dist/main.css.map +0 -1
  91. package/dist/main.js +0 -4832
  92. package/dist/main.js.map +0 -1
  93. package/dist/types.d.ts +0 -414
  94. package/dist/types.d.ts.map +0 -1
  95. /package/{dist/CMSGovLogo-O.90ce815c.png → lib/assets/images/CMSGovLogo-O.png} +0 -0
  96. /package/{dist/CMSgov@2x-white-O.78cd05d3.png → lib/assets/images/CMSgov@2x-white-O.png} +0 -0
package/dist/main.js DELETED
@@ -1,4832 +0,0 @@
1
- import "./main.css";
2
- import {jsxs as $hgUW1$jsxs, jsx as $hgUW1$jsx, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
3
- import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect} from "react";
4
- import {Button as $hgUW1$Button, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dropdown as $hgUW1$Dropdown, Badge as $hgUW1$Badge, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Choice as $hgUW1$Choice, 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";
5
- import $hgUW1$proptypes from "prop-types";
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
- import $hgUW1$swaggeruireact from "swagger-ui-react";
8
- import "swagger-ui-react/swagger-ui.css";
9
- import $hgUW1$qs from "qs";
10
- import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryClientProvider as $hgUW1$QueryClientProvider} from "@tanstack/react-query";
11
- import $hgUW1$axios from "axios";
12
- import $hgUW1$reacttexttruncate from "react-text-truncate";
13
- 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";
14
- import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
15
- import {usePopper as $hgUW1$usePopper} from "react-popper";
16
- import $hgUW1$reactdatepicker from "react-datepicker";
17
- import "react-datepicker/dist/react-datepicker.css";
18
-
19
- function $parcel$interopDefault(a) {
20
- return a && a.__esModule ? a.default : a;
21
- }
22
- // Components
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
- // import validator from 'validator';
34
- const $cf8eeac354b9dd32$var$NavLink = ({ link: link , className: className , wrapLabel: wrapLabel })=>{
35
- const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
36
- children: link.label
37
- }) : link.label;
38
- // if (validator.isURL(link.url, { require_protocol: true })) {
39
- // return (
40
- // <a className={className} href={link.url}>
41
- // {innerHtml}
42
- // </a>
43
- // );
44
- // } else {
45
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
46
- className: ({ isActive: isActive })=>isActive ? `dc-c-active-link ${className}` : `${className}`,
47
- to: link.url,
48
- children: innerHtml
49
- });
50
- // }
51
- };
52
- $cf8eeac354b9dd32$var$NavLink.defaultProps = {
53
- wrapLabel: false,
54
- className: null
55
- };
56
- $cf8eeac354b9dd32$var$NavLink.propTypes = {
57
- link: (0, $hgUW1$proptypes).shape({
58
- url: (0, $hgUW1$proptypes).string,
59
- label: (0, $hgUW1$proptypes).string
60
- }).isRequired,
61
- className: (0, $hgUW1$proptypes).string,
62
- /**
63
- * Will wrap the link label in a span for help with styling.
64
- */ wrapLabel: (0, $hgUW1$proptypes).bool
65
- };
66
- var $cf8eeac354b9dd32$export$2e2bcd8739ae039 = $cf8eeac354b9dd32$var$NavLink;
67
-
68
-
69
- const $4f153ca537d853e5$var$SubMenu = ({ link: link , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
70
- const [isExpanded, setIsExapanded] = (0, $hgUW1$useState)(false);
71
- const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
72
- children: link.label
73
- }) : link.label;
74
- const menu = (0, $hgUW1$useRef)();
75
- (0, $hgUW1$useEffect)(()=>{
76
- function handleClickOutside(event) {
77
- if (menu.current && !menu.current.contains(event.target)) setIsExapanded(false);
78
- }
79
- function handleFocusOut(event) {
80
- if (menu.current && !menu.current.contains(event.relatedTarget)) setIsExapanded(false);
81
- }
82
- document.addEventListener("mousedown", handleClickOutside);
83
- menu.current.addEventListener("focusout", handleFocusOut);
84
- return ()=>{
85
- document.removeEventListener("mousedown", handleClickOutside);
86
- if (menu.current) menu.current.removeEventListener("focusout", handleFocusOut);
87
- };
88
- }, [
89
- menu,
90
- isExpanded
91
- ]);
92
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
93
- className: `has-submenu ${isExpanded ? "open" : ""}`,
94
- ref: menu,
95
- children: [
96
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
97
- size: "small",
98
- variation: "ghost",
99
- onDark: true,
100
- className: linkClasses,
101
- "aria-haspopup": "true",
102
- "aria-expanded": isExpanded,
103
- onClick: (e)=>{
104
- e.preventDefault();
105
- setIsExapanded(!isExpanded);
106
- },
107
- children: innerHtml
108
- }),
109
- /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
110
- className: "dc-c-site-menu--sub-menu",
111
- children: link.submenu.map((s)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
112
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
113
- link: s,
114
- wrapLabel: wrapLabel
115
- })
116
- }, s.id))
117
- })
118
- ]
119
- });
120
- };
121
- var $4f153ca537d853e5$export$2e2bcd8739ae039 = $4f153ca537d853e5$var$SubMenu;
122
-
123
-
124
-
125
- const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menuId: menuId , menuClasses: menuClasses , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
126
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("nav", {
127
- className: `dc-c-${menuId}-menu`,
128
- "aria-labelledby": `dc-c-${menuId}-menu--heading`,
129
- children: [
130
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
131
- id: `dc-c-${menuId}-menu--heading`,
132
- className: "ds-u-visibility--screen-reader",
133
- children: menuName
134
- }),
135
- /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
136
- className: menuClasses,
137
- children: links.map((link)=>{
138
- if (link.submenu) return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4f153ca537d853e5$export$2e2bcd8739ae039), {
139
- link: link,
140
- wrapLabel: wrapLabel,
141
- linkClasses: linkClasses
142
- }, link.id);
143
- else return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
144
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
145
- link: link,
146
- className: linkClasses,
147
- wrapLabel: wrapLabel
148
- })
149
- }, link.id);
150
- })
151
- })
152
- ]
153
- });
154
- };
155
- $f57121650539d8c5$var$NavBar.defaultProps = {
156
- wrapLabel: false
157
- };
158
- var $f57121650539d8c5$export$2e2bcd8739ae039 = $f57121650539d8c5$var$NavBar;
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
- const $c96c4b9ef7203c1f$var$APIPage = ({ hideAuth: hideAuth , additionalParams: additionalParams , rootUrl: rootUrl })=>/*#__PURE__*/ (0, $hgUW1$jsx)("section", {
168
- className: "ds-l-container",
169
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
170
- url: `${rootUrl}?${hideAuth ? "authentication=false&" : ""}${additionalParams && additionalParams.ACA ? "ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
171
- docExpansion: "list",
172
- defaultModelsExpandDepth: -1
173
- })
174
- });
175
- $c96c4b9ef7203c1f$var$APIPage.defaultProps = {
176
- hideAuth: true
177
- };
178
- var $c96c4b9ef7203c1f$export$2e2bcd8739ae039 = $c96c4b9ef7203c1f$var$APIPage;
179
-
180
-
181
-
182
-
183
-
184
-
185
- const $026cb986f9fea2b1$var$PageNotFound = ({ siteUrl: siteUrl , content: content })=>{
186
- return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
187
- className: "ds-l-container ds-u-padding-top--3",
188
- children: content ? content : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
189
- children: [
190
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
191
- className: "ds-title",
192
- children: "Error: Page not found"
193
- }),
194
- /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
195
- children: [
196
- "We're sorry, but there is no ",
197
- siteUrl,
198
- " web page that matches your entry. You may have been directed here because:"
199
- ]
200
- }),
201
- /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
202
- children: [
203
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
204
- children: "The address you typed contains a typo;"
205
- }),
206
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
207
- children: "The requested page may have expired or;"
208
- }),
209
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
210
- children: "The requested page may have been moved."
211
- })
212
- ]
213
- }),
214
- /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
215
- children: [
216
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
217
- className: "ds-u-font-weight--bold",
218
- children: "Note:"
219
- }),
220
- " If you were using a bookmark, please reset it once you find the correct page."
221
- ]
222
- })
223
- ]
224
- })
225
- });
226
- };
227
- var $026cb986f9fea2b1$export$2e2bcd8739ae039 = $026cb986f9fea2b1$var$PageNotFound;
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
- const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)();
239
- const $61ff88fb3f6ee2c8$var$withQueryProvider = (WrappedComponent)=>(props)=>{
240
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$QueryClientProvider), {
241
- client: $61ff88fb3f6ee2c8$var$queryClient,
242
- children: /*#__PURE__*/ (0, $hgUW1$jsx)(WrappedComponent, {
243
- ...props
244
- })
245
- });
246
- };
247
- var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryProvider;
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
- const $bd76a91923d7e8a7$var$TransformedDate = ({ date: date , options: options })=>{
259
- const rawDate = new Date(date);
260
- let modifiedDate = "";
261
- if (rawDate) modifiedDate = rawDate.toLocaleDateString("en-US", options);
262
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
263
- children: modifiedDate
264
- });
265
- };
266
- $bd76a91923d7e8a7$var$TransformedDate.defaultProps = {
267
- options: {
268
- year: "numeric",
269
- month: "long",
270
- day: "numeric",
271
- timeZone: "UTC"
272
- }
273
- };
274
- var $bd76a91923d7e8a7$export$2e2bcd8739ae039 = $bd76a91923d7e8a7$var$TransformedDate;
275
-
276
-
277
-
278
- const $dc6d3aaf3e07417b$var$dangerousDescriptionElement = ({ children: children })=>/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
279
- dangerouslySetInnerHTML: {
280
- __html: children
281
- }
282
- });
283
- const $dc6d3aaf3e07417b$var$DatasetSearchListItem = ({ item: item , updateFacets: updateFacets })=>{
284
- const { title: title , modified: modified , description: description , theme: theme , keyword: keyword , identifier: identifier } = item;
285
- const truncatedDescription = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reacttexttruncate), {
286
- line: 3,
287
- element: "p",
288
- containerClassName: "ds-u-margin-top--0",
289
- truncateText: "…",
290
- textElement: $dc6d3aaf3e07417b$var$dangerousDescriptionElement,
291
- text: description,
292
- textTruncateChild: ""
293
- });
294
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
295
- className: "dc-dataset-searchlist-item ds-u-border-top--1 ds-u-margin-bottom--5",
296
- children: [
297
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
298
- className: "ds-l-row ds-u-padding-top--5",
299
- children: [
300
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
301
- className: "ds-l-col--7",
302
- children: theme && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
303
- className: "ds-u-padding--0 ds-u-display--flex ds-u-flex-direction--row ds-u-flex-wrap--wrap",
304
- children: theme.map((t)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
305
- className: "ds-u-margin-right--1 ds-u-margin-bottom--1",
306
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
307
- variation: "info",
308
- children: t
309
- })
310
- }, t))
311
- })
312
- }),
313
- /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
314
- className: "ds-l-col--5 ds-u-color--gray ds-u-text-align--right",
315
- children: [
316
- "Updated ",
317
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
318
- date: modified
319
- })
320
- ]
321
- })
322
- ]
323
- }),
324
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
325
- className: "ds-u-margin-y--1 ds-text-heading--xl",
326
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
327
- className: "ds-u-color--base",
328
- to: `/dataset/${identifier}`,
329
- children: title
330
- })
331
- }),
332
- truncatedDescription,
333
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
334
- children: keyword && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
335
- className: "ds-u-padding--0 ds-u-display--flex ds-u-flex-wrap--wrap",
336
- children: keyword.map((k)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
337
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
338
- className: "ds-u-radius ds-u-fill--primary-alt-lightest ds-u-color--base ds-u-margin-right--1 ds-u-margin-bottom--2",
339
- variation: "info",
340
- children: k
341
- })
342
- }, k))
343
- })
344
- })
345
- ]
346
- });
347
- };
348
- var $dc6d3aaf3e07417b$export$2e2bcd8739ae039 = $dc6d3aaf3e07417b$var$DatasetSearchListItem;
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
- function $19c005961efdef1a$export$e4d153b3e021fb47(currentFacet, selectedFacets) {
357
- let isSelected = -1;
358
- if (selectedFacets) isSelected = selectedFacets.findIndex((s)=>s === currentFacet);
359
- return isSelected;
360
- }
361
- const $19c005961efdef1a$var$DatasetSearchFacets = ({ title: title , facets: facets , onclickFunction: onclickFunction , selectedFacets: selectedFacets , loading: loading })=>{
362
- const showLimit = 25;
363
- const [isOpen, setIsOpen] = (0, $hgUW1$useState)(true);
364
- const [showMore, setShowMore] = (0, $hgUW1$useState)(false);
365
- const filteredFacets = facets.filter((f)=>{
366
- const selectedIndex = selectedFacets.findIndex((item)=>item === f.name);
367
- return f.total > 0 || selectedIndex !== -1;
368
- });
369
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
370
- className: "ds-u-margin-bottom--4 dc-dataset-search--facets-container",
371
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
372
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
373
- contentClassName: "ds-u-padding-left--1 ds-u-padding-right--0",
374
- heading: `${title} (${filteredFacets.length})`,
375
- defaultOpen: true,
376
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
377
- children: filteredFacets.length ? /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
378
- className: "dc-dataset-search--facets ds-u-padding--0 ds-u-margin--0",
379
- children: filteredFacets.map((f)=>{
380
- return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
381
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
382
- className: "ds-u-margin-y--1",
383
- checked: $19c005961efdef1a$export$e4d153b3e021fb47(f.name, selectedFacets) > -1 ? true : false,
384
- name: `facet_theme_${f.name}`,
385
- type: "checkbox",
386
- label: `${f.name} (${f.total})`,
387
- value: f.name,
388
- onClick: (e)=>onclickFunction({
389
- key: f.type,
390
- value: e.target.value
391
- })
392
- })
393
- }, f.name);
394
- })
395
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
396
- className: "ds-h5",
397
- children: "No matching facets found."
398
- })
399
- })
400
- })
401
- })
402
- });
403
- };
404
- $19c005961efdef1a$var$DatasetSearchFacets.defaultProps = {
405
- selectedFacets: []
406
- };
407
- $19c005961efdef1a$var$DatasetSearchFacets.propTypes = {
408
- title: (0, $hgUW1$proptypes).string.isRequired,
409
- facets: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
410
- type: (0, $hgUW1$proptypes).string.isRequired,
411
- name: (0, $hgUW1$proptypes).string.isRequired,
412
- total: (0, $hgUW1$proptypes).oneOfType([
413
- (0, $hgUW1$proptypes).number,
414
- (0, $hgUW1$proptypes).string
415
- ]).isRequired
416
- })).isRequired,
417
- onclickFunction: (0, $hgUW1$proptypes).func.isRequired
418
- };
419
- var $19c005961efdef1a$export$2e2bcd8739ae039 = $19c005961efdef1a$var$DatasetSearchFacets;
420
-
421
-
422
-
423
-
424
-
425
-
426
- function $116bd29db288848e$export$959638e8dca60ce6(facets) {
427
- let facetObj = {};
428
- if (facets) {
429
- facets.forEach((f)=>{
430
- if (facetObj[f.type]) facetObj[f.type] = [
431
- ...facetObj[f.type],
432
- f
433
- ];
434
- else facetObj[f.type] = [
435
- f
436
- ];
437
- });
438
- return facetObj;
439
- }
440
- }
441
- function $116bd29db288848e$export$b638ec7c7eac7f18(facets, alternateTitles) {
442
- let message = [];
443
- const keys = Object.keys(facets);
444
- keys.forEach((k)=>{
445
- if (facets[k].length) message.push(`${alternateTitles[k]}: ${facets[k].join(", ")}`);
446
- });
447
- return message.join(" & ");
448
- }
449
- function $116bd29db288848e$export$60ec7cc1d341a524(searchParams, facetList, defaultSortOptions) {
450
- const params = (0, $hgUW1$qs).parse(searchParams, {
451
- ignoreQueryPrefix: true
452
- });
453
- const selectedFacets = {};
454
- facetList.forEach((facet)=>{
455
- selectedFacets[facet] = params[facet] ? params[facet] : [];
456
- });
457
- return {
458
- page: params.page,
459
- sort: !params.sort ? defaultSortOptions.defaultSort : params.sort,
460
- sortOrder: !params.sortOrder ? defaultSortOptions.defaultOrder : params.sortOrder,
461
- fulltext: params.fulltext,
462
- selectedFacets: selectedFacets
463
- };
464
- }
465
- function $116bd29db288848e$export$73b41a3a66d60730(currentFacet, selectedFacets) {
466
- const isInSelectedFacets = selectedFacets[currentFacet.key] ? selectedFacets[currentFacet.key].indexOf(currentFacet.value) : -1;
467
- return isInSelectedFacets;
468
- }
469
- function $116bd29db288848e$export$9ef1e909a5e43470(currentFacet, selectedFacets) {
470
- const key = currentFacet["key"];
471
- let newFacetList = {
472
- ...selectedFacets
473
- };
474
- if (newFacetList[key]) {
475
- const existingFacet = $116bd29db288848e$export$73b41a3a66d60730(currentFacet, newFacetList);
476
- if (existingFacet > -1) newFacetList[key].splice(existingFacet, 1);
477
- else newFacetList[key] = [
478
- ...newFacetList[key],
479
- currentFacet.value
480
- ];
481
- } else newFacetList[key] = [
482
- currentFacet.value
483
- ];
484
- return newFacetList;
485
- }
486
- async function $116bd29db288848e$export$2d2256cb46e92ff7(rootUrl, options, additionalParams) {
487
- const { fulltext: fulltext , selectedFacets: selectedFacets , sort: sort , sortOrder: sortOrder , page: page , pageSize: pageSize } = options;
488
- let params = {
489
- fulltext: fulltext ? fulltext : undefined,
490
- ...selectedFacets,
491
- sort: sort ? sort : undefined,
492
- ["sort-order"]: sortOrder ? sortOrder : undefined,
493
- page: page !== 1 ? page : undefined,
494
- ["page-size"]: pageSize !== 10 ? pageSize : undefined,
495
- ...additionalParams
496
- };
497
- return await (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify(params, {
498
- arrayFormat: "comma",
499
- encode: false,
500
- skipEmptyString: true
501
- })}`);
502
- }
503
- function $116bd29db288848e$export$28fa7926a3fa4176(selectedFacets, fulltext, sort) {
504
- let newParams = {
505
- ...selectedFacets
506
- };
507
- if (fulltext) newParams.fulltext = fulltext;
508
- if (sort) newParams.sort = sort;
509
- return (0, $hgUW1$qs).stringify(newParams, {
510
- addQueryPrefix: true,
511
- encode: false,
512
- arrayFormat: "brackets"
513
- });
514
- }
515
-
516
-
517
-
518
-
519
- const $007dd6bfbe0f2956$var$DatasetSearch = ({ rootUrl: rootUrl , pageTitle: pageTitle , introText: introText , fulltextLabel: fulltextLabel , fulltextLabelClassName: fulltextLabelClassName , fulltextPlaceholder: fulltextPlaceholder , formClassName: formClassName , additionalParams: additionalParams , sortOptions: sortOptions , defaultSort: defaultSort , showSort: showSort })=>{
520
- const defaultSortBy = "";
521
- const defaultFulltext = "";
522
- const defaultSelectedFacets = {};
523
- const defaultSortOrder = "";
524
- const defaultPage = 1;
525
- const defaultPageSize = 10;
526
- const location = (0, $hgUW1$useLocation)();
527
- const transformedParams = (0, $116bd29db288848e$export$60ec7cc1d341a524)(location.search, [
528
- "theme",
529
- "keyword"
530
- ], defaultSort);
531
- const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)(null);
532
- const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
533
- let [searchParams, setSearchParams] = (0, $hgUW1$useSearchParams)();
534
- const [fulltext, setFullText] = (0, $hgUW1$useState)(transformedParams.fulltext);
535
- const [filterText, setFilterText] = (0, $hgUW1$useState)(transformedParams.fulltext);
536
- const [totalItems, setTotalItems] = (0, $hgUW1$useState)(null);
537
- const [page, setPage] = (0, $hgUW1$useState)(transformedParams.page ? transformedParams.page : defaultPage);
538
- const [sort, setSort] = (0, $hgUW1$useState)(transformedParams.sort ? transformedParams.sort : defaultSort ? defaultSort.defaultSort : defaultSortBy);
539
- const [sortOrder, setSortOrder] = (0, $hgUW1$useState)(transformedParams.sortOrder ? transformedParams.sortOrder : defaultSort ? defaultSort.defaultOrder : defaultSortOrder);
540
- const [selectedFacets, setSelectedFacets] = (0, $hgUW1$useState)(transformedParams.selectedFacets ? transformedParams.selectedFacets : defaultSelectedFacets);
541
- function updateSelectedFacets(currentFacet) {
542
- const facets = (0, $116bd29db288848e$export$9ef1e909a5e43470)(currentFacet, selectedFacets);
543
- setPage(1);
544
- setSelectedFacets(facets);
545
- }
546
- (0, $hgUW1$useEffect)(()=>{
547
- const baseNumber = Number(totalItems) > 0 ? 1 : 0;
548
- const startingNumber = baseNumber + (Number(pageSize) * Number(page) - Number(pageSize));
549
- const endingNumber = Number(pageSize) * Number(page);
550
- setCurrentResultNumbers({
551
- total: Number(totalItems),
552
- startingNumber: Number(totalItems) >= startingNumber ? startingNumber : 0,
553
- endingNumber: Number(totalItems) < endingNumber ? Number(totalItems) : endingNumber
554
- });
555
- if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
556
- else setNoResults(false);
557
- }, [
558
- totalItems,
559
- pageSize,
560
- page
561
- ]);
562
- (0, $hgUW1$useEffect)(()=>{
563
- var params = buildSearchParams(true);
564
- if (params !== location.search) setSearchParams(params);
565
- }, [
566
- page,
567
- sort,
568
- sortOrder,
569
- fulltext,
570
- selectedFacets
571
- ]);
572
- function resetFilters() {
573
- setFullText(defaultFulltext);
574
- setFilterText(defaultFulltext);
575
- setSelectedFacets(defaultSelectedFacets);
576
- setPage(defaultPage);
577
- }
578
- function buildSearchParams(includePage) {
579
- let newParams = {};
580
- if (Number(page) !== 1 && includePage) newParams.page = page;
581
- if (sort !== defaultSort.defaultSort) newParams.sort = sort;
582
- if (sortOrder !== defaultSort.defaultOrder) newParams.sortOrder = sortOrder;
583
- if (fulltext !== "") newParams.fulltext = fulltext;
584
- if (Object.keys(selectedFacets).length) Object.keys(selectedFacets).forEach((key)=>{
585
- newParams[key] = selectedFacets[key];
586
- });
587
- return (0, $hgUW1$qs).stringify(newParams, {
588
- addQueryPrefix: includePage,
589
- encode: true
590
- });
591
- }
592
- const pageSize = location.search.pageSize ? location.search.pageSize : defaultPageSize;
593
- let params = {
594
- fulltext: fulltext ? fulltext : undefined,
595
- ...selectedFacets,
596
- sort: sort ? sort : undefined,
597
- ["sort-order"]: sortOrder ? sortOrder : undefined,
598
- page: page !== 1 ? page : undefined,
599
- ["page-size"]: pageSize !== 10 ? pageSize : undefined,
600
- ...additionalParams
601
- };
602
- const { data: data , status: status , error: error } = (0, $hgUW1$useQuery)([
603
- "datasets",
604
- params
605
- ], ()=>(0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify(params, {
606
- arrayFormat: "comma",
607
- encode: false,
608
- skipEmptyString: true
609
- })}`));
610
- if (data && totalItems != data.data.total) setTotalItems(data.data.total);
611
- const { theme: theme , keyword: keyword } = (0, $116bd29db288848e$export$959638e8dca60ce6)(data ? data.data.facets : []);
612
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("section", {
613
- className: "ds-l-container",
614
- children: [
615
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
616
- className: "dc-search-header ds-title ds-u-margin-y--3",
617
- children: pageTitle
618
- }),
619
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
620
- className: "ds-l-row",
621
- children: [
622
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
623
- className: "ds-l-md-col--8 ds-l-sm-col--12ds-u-margin-bottom--3",
624
- children: [
625
- introText ? introText : null,
626
- /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
627
- onSubmit: (e)=>{
628
- e.preventDefault();
629
- ()=>{
630
- setFullText(filterText);
631
- setPage(defaultPage);
632
- };
633
- },
634
- className: formClassName,
635
- children: [
636
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
637
- fieldClassName: "ds-u-margin--0",
638
- value: filterText,
639
- className: "dc-fulltext--input-container ds-u-padding-right--2",
640
- label: fulltextLabel,
641
- labelClassName: fulltextLabelClassName,
642
- placeholder: fulltextPlaceholder,
643
- name: "dataset_fulltext_search",
644
- onChange: (e)=>setFilterText(e.target.value)
645
- }),
646
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
647
- type: "submit",
648
- variation: "solid",
649
- htmlFor: "dataset_fulltext_search",
650
- onClick: ()=>{
651
- setFullText(filterText);
652
- setPage(defaultPage);
653
- },
654
- children: "Search"
655
- })
656
- ]
657
- }),
658
- status === "loading" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
659
- className: "ds-u-valign--middle",
660
- "aria-valuetext": "Dataset Search loading",
661
- role: "status"
662
- }) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
663
- children: [
664
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
665
- className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--end",
666
- children: [
667
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
668
- children: [
669
- currentResultNumbers && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
670
- className: "ds-u-margin-y--0",
671
- children: [
672
- "Showing ",
673
- currentResultNumbers.startingNumber,
674
- " -",
675
- " ",
676
- currentResultNumbers.endingNumber,
677
- " of ",
678
- data.data.total,
679
- " datasets"
680
- ]
681
- }),
682
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
683
- className: "ds-u-margin-y--0",
684
- children: (0, $116bd29db288848e$export$b638ec7c7eac7f18)(selectedFacets, {
685
- theme: "Categories",
686
- keyword: "Tags"
687
- })
688
- })
689
- ]
690
- }),
691
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
692
- className: "ds-u-padding--0 dc-c-clear-filters",
693
- variation: "ghost",
694
- onClick: ()=>resetFilters(),
695
- children: "Clear all filters"
696
- })
697
- ]
698
- }),
699
- /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
700
- className: "dc-dataset-search-list ds-u-padding--0",
701
- children: [
702
- noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
703
- variation: "error",
704
- heading: "No results found."
705
- }),
706
- Object.keys(data.data.results).map((key)=>{
707
- return data.data.results[key];
708
- }).map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
709
- className: "ds-u-padding--0",
710
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $dc6d3aaf3e07417b$export$2e2bcd8739ae039), {
711
- item: item,
712
- updateFacets: updateSelectedFacets
713
- })
714
- }, item.identifier))
715
- ]
716
- }),
717
- data.data.total != 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
718
- id: "test-default",
719
- currentPage: Number(page),
720
- totalPages: Math.ceil(Number(data.data.total) / pageSize),
721
- onPageChange: (evt, page)=>{
722
- evt.preventDefault();
723
- window.scroll(0, 0);
724
- setPage(page);
725
- },
726
- renderHref: (page)=>{
727
- const searchParams = buildSearchParams(false);
728
- const includeAnd = searchParams ? "&" : "";
729
- return `/datasets?page=${page}${includeAnd}${searchParams}`;
730
- }
731
- })
732
- ]
733
- })
734
- ]
735
- }),
736
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
737
- className: "ds-l-md-col--4 ds-l-sm-col--12",
738
- children: [
739
- showSort && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
740
- className: "ds-u-padding--2 ds-u-margin-bottom--4 ds-u-border--1",
741
- children: [
742
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
743
- options: sortOptions,
744
- value: sort,
745
- label: "Sort by",
746
- labelClassName: "ds-u-margin-top--0",
747
- name: "dataset_search_sort",
748
- onChange: (e)=>setSort(e.target.value)
749
- }),
750
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
751
- options: [
752
- {
753
- label: "Ascending",
754
- value: "asc"
755
- },
756
- {
757
- label: "Descending",
758
- value: "desc"
759
- }
760
- ],
761
- value: sortOrder,
762
- label: "Sort order",
763
- labelClassName: "ds-u-margin-top--0",
764
- name: "dataset_search_sort_order",
765
- onChange: (e)=>setSortOrder(e.target.value)
766
- })
767
- ]
768
- }),
769
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
770
- className: "ds-u-padding--2 ds-u-margin-bottom--4 ds-u-border--1",
771
- children: [
772
- theme ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $19c005961efdef1a$export$2e2bcd8739ae039), {
773
- title: "Categories",
774
- facets: theme,
775
- onclickFunction: updateSelectedFacets,
776
- selectedFacets: selectedFacets.theme,
777
- loading: status === "loading"
778
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
779
- className: "ds-u-valign--middle",
780
- "aria-valuetext": "Categories loading",
781
- role: "status"
782
- }),
783
- keyword ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $19c005961efdef1a$export$2e2bcd8739ae039), {
784
- title: "Tags",
785
- facets: keyword,
786
- onclickFunction: updateSelectedFacets,
787
- selectedFacets: selectedFacets.keyword,
788
- loading: status === "loading"
789
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
790
- className: "ds-u-valign--middle",
791
- "aria-valuetext": "Tags loading",
792
- role: "status"
793
- })
794
- ]
795
- })
796
- ]
797
- })
798
- ]
799
- })
800
- ]
801
- });
802
- };
803
- $007dd6bfbe0f2956$var$DatasetSearch.defaultProps = {
804
- pageTitle: "Datasets",
805
- introText: "",
806
- fulltextLabel: "Search term",
807
- fulltextLabelClassName: "ds-u-visibility--screen-reader",
808
- fulltextPlaceholder: "Type search term here",
809
- formClassName: "ds-u-display--flex ds-u-justify-content--between ds-u-margin-bottom--2",
810
- showSort: true,
811
- sortOptions: [
812
- {
813
- label: "Recently Updated",
814
- value: "modified"
815
- },
816
- {
817
- label: "Title",
818
- value: "title"
819
- }
820
- ],
821
- defaultSort: {
822
- defaultSort: "modified",
823
- defaultOrder: "desc"
824
- }
825
- };
826
- var $007dd6bfbe0f2956$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($007dd6bfbe0f2956$var$DatasetSearch);
827
-
828
-
829
-
830
-
831
-
832
-
833
-
834
-
835
-
836
-
837
- const $68d79598b83f3382$var$useMetastoreDataset = (datasetId, rootAPIUrl, additionalParams = {})=>{
838
- const [dataset, setDataset] = (0, $hgUW1$useState)({});
839
- const [id, setId] = (0, $hgUW1$useState)(datasetId);
840
- const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
841
- const additionalParamsString = Object.keys(additionalParams).length ? `&${(0, $hgUW1$qs).stringify(additionalParams)}` : "";
842
- (0, $hgUW1$useEffect)(()=>{
843
- async function fetchData() {
844
- return (0, $hgUW1$axios).get(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>setDataset(res.data)).catch((error)=>setDataset({
845
- error: error
846
- }));
847
- }
848
- fetchData();
849
- }, [
850
- id,
851
- rootUrl
852
- ]);
853
- return {
854
- dataset: dataset,
855
- setId: setId,
856
- setRootUrl: setRootUrl
857
- };
858
- };
859
- var $68d79598b83f3382$export$2e2bcd8739ae039 = $68d79598b83f3382$var$useMetastoreDataset;
860
-
861
-
862
-
863
-
864
-
865
-
866
-
867
-
868
-
869
-
870
-
871
-
872
- async function $0e7628cf73c71646$export$55f990b5477765d6(id, rootUrl, options, additionalParams) {
873
- const { keys: keys , limit: limit , offset: offset , conditions: conditions , sort: sort , groupings: groupings , prepareColumns: prepareColumns , properties: properties , setValues: setValues , setCount: setCount , setColumns: setColumns , setLoading: setLoading , setSchema: setSchema } = options;
874
- if (!id) // TODO: Throw error
875
- return false;
876
- if (typeof setLoading === "function") setLoading(true);
877
- return await (0, $hgUW1$axios)({
878
- method: "GET",
879
- url: `${rootUrl}/datastore/query/${id}`,
880
- params: {
881
- keys: keys,
882
- limit: limit,
883
- offset: offset,
884
- conditions: conditions,
885
- sorts: sort,
886
- properties: properties,
887
- groupings: groupings,
888
- ...additionalParams
889
- },
890
- paramsSerializer: {
891
- serialize: (0, $hgUW1$qs).stringify
892
- }
893
- }).then((res)=>{
894
- const { data: data } = res;
895
- const propertyKeys = data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
896
- setValues(data.results), setCount(data.count);
897
- if (propertyKeys.length) setColumns(prepareColumns ? prepareColumns(propertyKeys) : propertyKeys);
898
- setSchema(data.schema);
899
- if (typeof setLoading === "function") setLoading(false);
900
- return data;
901
- });
902
- }
903
-
904
-
905
- const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, additionalParams = {})=>{
906
- const keys = options.keys ? options.keys : true;
907
- const { prepareColumns: prepareColumns } = options;
908
- const [manual, setManual] = (0, $hgUW1$useState)(options.manual ? options.manual : false);
909
- const [requireConditions, setRequireConditions] = (0, $hgUW1$useState)(options.requireConditions ? options.requireConditions : false);
910
- const [values, setValues] = (0, $hgUW1$useState)([]);
911
- const [id, setResource] = (0, $hgUW1$useState)(resourceId);
912
- const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
913
- const [limit, setLimit] = (0, $hgUW1$useState)(options.limit ? options.limit : 20);
914
- const [count, setCount] = (0, $hgUW1$useState)(null);
915
- const [columns, setColumns] = (0, $hgUW1$useState)([]);
916
- const [offset, setOffset] = (0, $hgUW1$useState)(options.offset ? options.offset : 0);
917
- const [loading, setLoading] = (0, $hgUW1$useState)(false);
918
- const [conditions, setConditions] = (0, $hgUW1$useState)(options.conditions ? options.conditions : undefined);
919
- const [sort, setSort] = (0, $hgUW1$useState)(options.sort ? options.sort : undefined);
920
- const [groupings, setGroupings] = (0, $hgUW1$useState)(options.groupings ? options.groupings : undefined);
921
- const [schema, setSchema] = (0, $hgUW1$useState)({});
922
- // const [joins, setJoins] = useState()
923
- const [properties, setProperties] = (0, $hgUW1$useState)(options.properties ? options.properties : undefined);
924
- const prevLimitRef = (0, $hgUW1$useRef)();
925
- const prevOffsetRef = (0, $hgUW1$useRef)();
926
- (0, $hgUW1$useEffect)(()=>{
927
- prevLimitRef.current = limit;
928
- prevOffsetRef.current = offset;
929
- });
930
- const prevLimit = prevLimitRef.current;
931
- const prevOffset = prevOffsetRef.current;
932
- function fetchData() {
933
- let newOffset = prevLimit === limit ? prevOffset !== offset ? offset : 0 : 0;
934
- setOffset(newOffset);
935
- (0, $0e7628cf73c71646$export$55f990b5477765d6)(id, rootUrl, {
936
- keys: keys,
937
- limit: limit,
938
- offset: newOffset,
939
- conditions: conditions,
940
- sort: sort,
941
- groupings: groupings,
942
- prepareColumns: prepareColumns,
943
- properties: properties,
944
- setValues: setValues,
945
- setCount: setCount,
946
- setColumns: setColumns,
947
- setLoading: setLoading,
948
- setSchema: setSchema,
949
- setProperties: setProperties
950
- }, additionalParams);
951
- }
952
- (0, $hgUW1$useEffect)(()=>{
953
- if (!loading && !manual) {
954
- if (!requireConditions) fetchData();
955
- else if (requireConditions) {
956
- if (conditions && conditions.length) fetchData();
957
- else {
958
- setCount(null);
959
- setValues([]);
960
- }
961
- }
962
- }
963
- }, [
964
- id,
965
- rootUrl,
966
- offset,
967
- conditions,
968
- sort,
969
- limit,
970
- requireConditions
971
- ]);
972
- return {
973
- loading: loading,
974
- values: values,
975
- count: count,
976
- columns: columns,
977
- limit: limit,
978
- offset: offset,
979
- schema: schema,
980
- conditions: conditions,
981
- properties: properties,
982
- setProperties: setProperties,
983
- setGroupings: setGroupings,
984
- setResource: setResource,
985
- setRootUrl: setRootUrl,
986
- setLimit: setLimit,
987
- setOffset: setOffset,
988
- setConditions: setConditions,
989
- setSort: setSort,
990
- setManual: setManual,
991
- setRequireConditions: setRequireConditions,
992
- fetchData: fetchData
993
- };
994
- };
995
- var $1d3d480a9cfaabe0$export$2e2bcd8739ae039 = $1d3d480a9cfaabe0$var$useDatastore;
996
-
997
-
998
-
999
-
1000
-
1001
-
1002
-
1003
- // OPERATORS
1004
- // =
1005
- // <> not equal to
1006
- // BETWEEN
1007
- // IN
1008
- // NOT IN
1009
- // >=
1010
- // <=
1011
- // like
1012
- function $ead72e621d62e6fc$export$64030b8086b23b59(filterArray) {
1013
- const conditions = filterArray.map((f)=>{
1014
- return {
1015
- resource: "t",
1016
- property: f.id,
1017
- value: `%${f.value}%`,
1018
- operator: "LIKE"
1019
- };
1020
- });
1021
- return conditions;
1022
- }
1023
- function $ead72e621d62e6fc$export$5bccb6115193eb03(filterArray) {
1024
- if (!filterArray || filterArray.length === 0) return "";
1025
- const where_clauses = [];
1026
- filterArray.forEach((v, i)=>{
1027
- // Switch delimiter to, and strip any double-quote for Dkan2's sql query.
1028
- let value = `%25${v.value}%25`;
1029
- where_clauses[i] = `${v.id} = "${v.value.replace('"', "")}"`;
1030
- });
1031
- return `[WHERE ${where_clauses.join(" AND ")}]`;
1032
- }
1033
-
1034
-
1035
- function $aa4450dcbeef3ac0$export$385a5aba38cc3325(sortArray) {
1036
- let newQuery = [];
1037
- sortArray.forEach((s)=>{
1038
- return newQuery.push({
1039
- property: s.id,
1040
- order: s.desc ? "desc" : "asc"
1041
- });
1042
- });
1043
- return newQuery;
1044
- }
1045
-
1046
-
1047
-
1048
-
1049
-
1050
-
1051
-
1052
-
1053
- const $d98f94c79ddf4e0e$var$DataTable = ({ data: data , columns: // filterTitle,
1054
- columns , sortDefaults: // totalRows,
1055
- // limit,
1056
- // loading,
1057
- // options,
1058
- // columnDefaults,
1059
- sortDefaults , setSort: setSort , sortTransform: // setConditions,
1060
- // conditionsTransform,
1061
- sortTransform , className: className , tablePadding: tablePadding , allowOverflow: allowOverflow })=>{
1062
- const [sorting, setSorting] = (0, $hgUW1$react).useState([]);
1063
- const columnHelper = (0, $hgUW1$createColumnHelper)();
1064
- const table_columns = columns.map((col)=>columnHelper.accessor(col.accessor, {
1065
- header: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1066
- children: col.Header
1067
- })
1068
- }));
1069
- const sortElement = (isSorted, onClickFn)=>{
1070
- if (isSorted === "asc") return "dc-c-sort--asc";
1071
- if (isSorted === "desc") return "dc-c-sort--desc";
1072
- return "dc-c-sort--default";
1073
- };
1074
- const filters = [];
1075
- const table = (0, $hgUW1$useReactTable)({
1076
- data: data,
1077
- columns: table_columns,
1078
- manualSorting: true,
1079
- state: {
1080
- sorting: sorting
1081
- },
1082
- columnResizeMode: "onChange",
1083
- onSortingChange: setSorting,
1084
- getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
1085
- getSortedRowModel: (0, $hgUW1$getSortedRowModel)(),
1086
- debugTable: true
1087
- });
1088
- (0, $hgUW1$react).useEffect(()=>{
1089
- const normalizedSort = sortTransform ? sortTransform(sorting) : filters;
1090
- setSort(normalizedSort);
1091
- }, [
1092
- sorting
1093
- ]);
1094
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1095
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("table", {
1096
- tabIndex: 0,
1097
- style: {
1098
- width: allowOverflow ? table.getCenterTotalSize() : "100%",
1099
- maxWidth: allowOverflow ? table.getCenterTotalSize() : "100%",
1100
- minWidth: allowOverflow ? table.getCenterTotalSize() : "100%"
1101
- },
1102
- className: "dc-c-datatable",
1103
- children: [
1104
- /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
1105
- children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1106
- className: "",
1107
- children: headerGroup.headers.map((header)=>/*#__PURE__*/ (0, $hgUW1$jsx)("th", {
1108
- key: header.id,
1109
- style: {
1110
- width: header.getSize()
1111
- },
1112
- className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
1113
- children: header.isPlaceholder ? null : /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1114
- children: [
1115
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1116
- className: header.column.getCanSort() ? `cursor-pointer select-none ${sortElement(header.column.getIsSorted())}` : "",
1117
- onClick: header.column.getToggleSortingHandler(),
1118
- children: (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1119
- }),
1120
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1121
- onMouseDown: header.getResizeHandler(),
1122
- onTouchStart: header.getResizeHandler(),
1123
- className: `dc-c-resize-handle ${header.column.getIsResizing() ? "isResizing" : ""}`
1124
- })
1125
- ]
1126
- })
1127
- }))
1128
- }, headerGroup.id))
1129
- }),
1130
- /*#__PURE__*/ (0, $hgUW1$jsx)("tbody", {
1131
- children: table.getRowModel().rows.map((row, index)=>{
1132
- const even = (index + 1) % 2 === 0;
1133
- return /*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
1134
- className: `${even ? "dc-c-datatable--even-row" : ""}`,
1135
- children: row.getVisibleCells().map((cell)=>{
1136
- let classList = "dc-truncate ds-u-padding-x--1";
1137
- return /*#__PURE__*/ (0, $hgUW1$jsx)("td", {
1138
- key: cell.id,
1139
- style: {
1140
- maxWidth: cell.column.getSize()
1141
- },
1142
- className: `${classList} ${tablePadding}`,
1143
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1144
- children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
1145
- })
1146
- });
1147
- })
1148
- }, row.id);
1149
- })
1150
- })
1151
- ]
1152
- })
1153
- });
1154
- // const tableClasses = {
1155
- // tableContainerClassName: 'dc-c-table-container',
1156
- // headerCellClassName:
1157
- // 'ds-u-border--dark ds-u-padding--2 ds-u-border-y--2 ds-u-font-weight--bold dc-c-table-header-cell',
1158
- // headerGroupClassName: 'dc-c-table-header-group',
1159
- // headerCellTextClassName: `${
1160
- // truncateCellHeader ? 'dc-truncate' : ''
1161
- // } ds-u-display--inline-block`,
1162
- // cellEvenRowClassName: 'ds-u-fill--gray-lightest',
1163
- // cellClassName: `${tablePadding} dc-truncate ds-u-padding-x--1`,
1164
- // filterTitleClassName:
1165
- // 'ds-u-font-weight--bold ds-u-padding-left--2 ds-u-fill--gray-lightest ds-u-display--block',
1166
- // headerFilterClassName: 'ds-u-padding-top--1 ds-u-fill--gray-lightest',
1167
- // headerFilterCellClassName:
1168
- // 'ds-u-padding-x--1 ds-u-padding-bottom--0 ds-u-border-bottom--0 ds-u-fill--gray-lightest',
1169
- // columnIsSortedClassName: 'dc-c-sort dc-c-sort--default',
1170
- // columnIsSortedAscClassName: 'dc-c-sort dc-c-sort--asc',
1171
- // columnIsSortedDecClassName: 'dc-c-sort dc-c-sort--desc',
1172
- // tableColumnResizer: 'dc-c-resize-handle',
1173
- // tableColumnIsResizing: 'isResizing',
1174
- // ...customClasses,
1175
- // };
1176
- // const { layout, columnFilter, columnSort, columnResize } = options;
1177
- // const { minWidth, maxWidth, width } = columnDefaults;
1178
- // const {
1179
- // tableContainerClassName,
1180
- // headerCellClassName,
1181
- // headerGroupClassName,
1182
- // defaultColumnFilterClassName,
1183
- // cellClassName,
1184
- // cellFirstRowClassName,
1185
- // cellEvenRowClassName,
1186
- // cellOddRowClassName,
1187
- // tableColumnResizer,
1188
- // tableColumnIsResizing,
1189
- // headerCellTextClassName,
1190
- // filterTitleClassName,
1191
- // headerFilterClassName,
1192
- // headerFilterCellClassName,
1193
- // columnIsSortedClassName,
1194
- // columnIsSortedAscClassName,
1195
- // columnIsSortedDecClassName,
1196
- // } = tableClasses;
1197
- // if (columns.length === 0) {
1198
- // return <p>Loading</p>;
1199
- // }
1200
- // const filterTypes = React.useMemo(
1201
- // () => ({
1202
- // // Add a new fuzzyTextFilterFn filter type.
1203
- // // fuzzyText: fuzzyTextFilterFn,
1204
- // // Or, override the default text filter to use
1205
- // // "startWith"
1206
- // text: (rows, id, filterValue) =>
1207
- // rows.filter((row) => {
1208
- // const rowValue = row.values[id];
1209
- // return rowValue !== undefined
1210
- // ? String(rowValue)
1211
- // .toLowerCase()
1212
- // .startsWith(String(filterValue).toLowerCase())
1213
- // : true;
1214
- // }),
1215
- // }),
1216
- // []
1217
- // );
1218
- // function DefaultColumnFilter({
1219
- // column: { Header, accessor, setFilter, filterValue },
1220
- // }) {
1221
- // return (
1222
- // <div>
1223
- // <label
1224
- // className={defaultColumnFilterClassName}
1225
- // htmlFor={`filter_${accessor}`}
1226
- // >
1227
- // {`Filter ${Header}`}
1228
- // </label>
1229
- // <input
1230
- // className="usa-input margin-bottom-1"
1231
- // onChange={(e) => {
1232
- // setFilter(e.target.value) || undefined;
1233
- // }}
1234
- // id={`filter_${accessor}`}
1235
- // name={`filter_${accessor}`}
1236
- // type="text"
1237
- // value={filterValue || ""}
1238
- // />
1239
- // </div>
1240
- // );
1241
- // }
1242
- // const defaultColumn = React.useMemo(
1243
- // () => ({
1244
- // // Let's set up our default Filter UI
1245
- // Filter: customColumnFilter ? customColumnFilter : DefaultColumnFilter,
1246
- // // When using the useFlexLayout:
1247
- // minWidth: minWidth, // minWidth is only used as a limit for resizing
1248
- // width: width, // width is used for both the flex-basis and flex-grow
1249
- // maxWidth: maxWidth, // maxWidth is only used as a limit for resizing
1250
- // }),
1251
- // []
1252
- // );
1253
- // const {
1254
- // getTableProps,
1255
- // prepareRow,
1256
- // rows,
1257
- // headerGroups,
1258
- // state: { filters, sortBy },
1259
- // } = useReactTable(
1260
- // {
1261
- // columns,
1262
- // data,
1263
- // filterTypes,
1264
- // initialState: {
1265
- // sortBy: sortDefaults
1266
- // },
1267
- // manualPagination: true,
1268
- // manualFilters: true,
1269
- // manualSortBy: true,
1270
- // pageCount: Math.ceil(totalRows / limit),
1271
- // filterTypes,
1272
- // defaultColumn,
1273
- // },
1274
- // // useResizeColumns,
1275
- // // useFilters,
1276
- // // useSortBy,
1277
- // // usePagination,
1278
- // // layout === "block" ? useBlockLayout : useFlexLayout
1279
- // );
1280
- // useEffect(() => {
1281
- // let timerFunc = setTimeout(() => {
1282
- // if (columnFilter) {
1283
- // const normalizedFilters = conditionsTransform
1284
- // ? conditionsTransform(filters)
1285
- // : filters;
1286
- // setConditions(normalizedFilters);
1287
- // }
1288
- // }, 1000);
1289
- // return () => clearTimeout(timerFunc);
1290
- // }, [filters]);
1291
- // return (
1292
- // <div className={className} tabIndex="0">
1293
- // TABLE
1294
- // </div>
1295
- // <div {...getTableProps()} className={className} tabIndex="0">
1296
- // <div className={tableContainerClassName}>
1297
- // {headerGroups.map((headerGroup) => {
1298
- // return(
1299
- // <div
1300
- // {...headerGroup.getHeaderGroupProps()}
1301
- // className={headerGroupClassName}
1302
- // >
1303
- // {headerGroup.headers.map((column) => {
1304
- // return(
1305
- // <div key={column.id}>
1306
- // <div
1307
- // className={headerCellClassName}
1308
- // {...column.getHeaderProps(
1309
- // columnSort ? column.getSortByToggleProps((props) => ({...props, title: `Sort by ${column.Header}`})) : undefined
1310
- // )}
1311
- // >
1312
- // <span className={headerCellTextClassName}>
1313
- // {column.render("Header")}
1314
- // </span>
1315
- // {columnSort && (
1316
- // <span
1317
- // className={
1318
- // column.isSorted
1319
- // ? column.isSortedDesc
1320
- // ? columnIsSortedDecClassName
1321
- // : columnIsSortedAscClassName
1322
- // : columnIsSortedClassName
1323
- // }
1324
- // />
1325
- // )}
1326
- // </div>
1327
- // {columnResize && (
1328
- // <div
1329
- // {...column.getResizerProps()}
1330
- // className={`${tableColumnResizer} ${
1331
- // column.isResizing ? tableColumnIsResizing : ""
1332
- // }`}
1333
- // />
1334
- // )}
1335
- // </div>
1336
- // )
1337
- // })}
1338
- // </div>
1339
- // )
1340
- // })}
1341
- // {columnFilter && (
1342
- // <div className={headerFilterClassName}>
1343
- // {filterTitle && (
1344
- // <span className={filterTitleClassName}>{filterTitle}</span>
1345
- // )}
1346
- // {headerGroups.map((headerGroup) => (
1347
- // <div {...headerGroup.getHeaderGroupProps()}>
1348
- // {headerGroup.headers.map((column) => (
1349
- // <div
1350
- // {...column.getHeaderProps()}
1351
- // className={headerFilterCellClassName}
1352
- // >
1353
- // <div className="th">
1354
- // <div>
1355
- // {column.canFilter ? column.render("Filter") : null}
1356
- // </div>
1357
- // </div>
1358
- // </div>
1359
- // ))}
1360
- // </div>
1361
- // ))}
1362
- // </div>
1363
- // )}
1364
- // </div>
1365
- // <div className="tbody">
1366
- // {loading ? (
1367
- // CustomLoadingComponent ? (
1368
- // CustomLoadingComponent
1369
- // ) : (
1370
- // <p>Loading...</p>
1371
- // )
1372
- // ) : rows.length ? (
1373
- // rows.map((row, index) => {
1374
- // const even = (index + 1) % 2 === 0;
1375
- // prepareRow(row);
1376
- // let classList = cellClassName;
1377
- // if (index === 0 && cellFirstRowClassName) {
1378
- // classList = cellFirstRowClassName;
1379
- // }
1380
- // if (even) {
1381
- // classList += ` ${cellEvenRowClassName}`;
1382
- // }
1383
- // if (!even) {
1384
- // classList += ` ${cellOddRowClassName}`;
1385
- // }
1386
- // return (
1387
- // <div {...row.getRowProps()} className="tr">
1388
- // {row.cells.map((cell) => {
1389
- // return (
1390
- // <div {...cell.getCellProps()} className={classList}>
1391
- // <span className={cellTextClassName}>
1392
- // {cell.render("Cell")}
1393
- // </span>
1394
- // </div>
1395
- // );
1396
- // })}
1397
- // </div>
1398
- // );
1399
- // })
1400
- // ) : CustomNoResults ? (
1401
- // CustomNoResults
1402
- // ) : (
1403
- // <p>No results found.</p>
1404
- // )}
1405
- // </div>
1406
- // </div>
1407
- // );
1408
- };
1409
- var // DataTable.defaultProps = {
1410
- // filterTitle: "",
1411
- // className: "",
1412
- // tableClasses: {
1413
- // tableContainerClassName: "",
1414
- // tableColumnResizer:
1415
- // "width-1 bg-primary margin-right-neg-05 position-absolute top-0 bottom-0 right-0 z-100",
1416
- // tableColumnIsResizing: "",
1417
- // headerCellClassName:
1418
- // "bg-base-lighter border-top-1px text-right text-bold padding-x-1 overflow-hidden",
1419
- // headerGroupClassName: "",
1420
- // headerCellTextClassName:
1421
- // "overflow-hidden text-no-wrap display-inline-block",
1422
- // defaultColumnFilterClassName: "usa-label usa-sr-only",
1423
- // cellTextClassName: "overflow-hidden text-no-wrap display-inline-block",
1424
- // cellFirstRowClassName: "",
1425
- // cellClassName:
1426
- // "border-right-1px font-mono-sm text-tabular text-right padding-x-105 padding-y-05",
1427
- // cellEvenRowClassName: "bg-base-lightest",
1428
- // cellOddRowClassName: "",
1429
- // filterTitleClassName: "",
1430
- // headerFilterCellClassName:
1431
- // "bg-base-lighter border-bottom-1px border-right-1px padding-x-1",
1432
- // headerFilterClassName: "",
1433
- // columnIsSortedClassName: "",
1434
- // columnIsSortedAscClassName: "",
1435
- // columnIsSortedDecClassName: "",
1436
- // },
1437
- // options: {
1438
- // layout: "flex",
1439
- // columnFilter: true,
1440
- // columnSort: true,
1441
- // columnResize: true,
1442
- // },
1443
- // columnDefaults: {
1444
- // minWidth: 30,
1445
- // maxWidth: 300,
1446
- // width: 150,
1447
- // },
1448
- // customColumnFilter: undefined,
1449
- // sortDefaults: []
1450
- // };
1451
- // DataTable.propTypes = {
1452
- // options: PropTypes.shape({
1453
- // layout: PropTypes.oneOf(["flex", "block"]),
1454
- // columnFilter: PropTypes.bool,
1455
- // columnSort: PropTypes.bool,
1456
- // columnResize: PropTypes.bool,
1457
- // }),
1458
- // sortDefaults: PropTypes.arrayOf(
1459
- // PropTypes.shape({
1460
- // id: PropTypes.string,
1461
- // desc: PropTypes.bool,
1462
- // })
1463
- // ),
1464
- // columns: PropTypes.arrayOf(
1465
- // PropTypes.shape({
1466
- // Header: PropTypes.string.isRequired,
1467
- // accessor: PropTypes.string.isRequired,
1468
- // })
1469
- // ).isRequired,
1470
- // setSort: PropTypes.func.isRequired,
1471
- // setConditions: PropTypes.func.isRequired,
1472
- // conditionsTransform: PropTypes.func,
1473
- // sortTransform: PropTypes.func,
1474
- // data: PropTypes.arrayOf(PropTypes.object),
1475
- // className: PropTypes.string,
1476
- // filterTitle: PropTypes.string,
1477
- // totalRows: PropTypes.number.isRequired,
1478
- // limit: PropTypes.number.isRequired,
1479
- // loading: PropTypes.bool,
1480
- // columnDefaults: PropTypes.shape({
1481
- // minWidth: PropTypes.number,
1482
- // maxWidth: PropTypes.number,
1483
- // width: PropTypes.number,
1484
- // }),
1485
- // customColumnFilter: PropTypes.func,
1486
- // // tableClasses,
1487
- // // cellTextClassName
1488
- // };
1489
- $d98f94c79ddf4e0e$export$2e2bcd8739ae039 = $d98f94c79ddf4e0e$var$DataTable;
1490
-
1491
-
1492
-
1493
-
1494
- function $626282d9a03c51d5$var$calculateMaxWidth(previewSize) {
1495
- return Math.floor(previewSize * 0.84);
1496
- }
1497
- function $626282d9a03c51d5$export$1147582dfae658c6(columns, schema) {
1498
- return columns.map((column)=>({
1499
- Header: schema && schema.fields[column].description ? schema.fields[column].description : column,
1500
- accessor: column
1501
- }));
1502
- }
1503
- function $626282d9a03c51d5$var$DefaultColumnFilter({ column: { Header: Header , accessor: accessor , setFilter: setFilter , filterValue: filterValue } }) {
1504
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
1505
- label: `Filter by ${Header}`,
1506
- onChange: (e)=>{
1507
- setFilter(e.target.value) || undefined;
1508
- },
1509
- labelClassName: "ds-u-visibility--screen-reader",
1510
- name: accessor,
1511
- value: filterValue || ""
1512
- });
1513
- }
1514
- const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding , id: id , options: options , resource: resource , defaultSort: defaultSort , customColumns: customColumns , truncateCellHeader: truncateCellHeader , columnSettings: columnSettings , columnWidths: columnWidths , customClasses: customClasses , allowOverflow: allowOverflow })=>{
1515
- const tableClasses = {
1516
- tableContainerClassName: "dc-c-table-container",
1517
- headerCellClassName: "ds-u-border--dark ds-u-padding--2 ds-u-border-y--2 ds-u-font-weight--bold dc-c-table-header-cell",
1518
- headerGroupClassName: "dc-c-table-header-group",
1519
- headerCellTextClassName: `${truncateCellHeader ? "dc-truncate" : ""} ds-u-display--inline-block`,
1520
- cellEvenRowClassName: "ds-u-fill--gray-lightest",
1521
- cellClassName: `${tablePadding} dc-truncate ds-u-padding-x--1`,
1522
- filterTitleClassName: "ds-u-font-weight--bold ds-u-padding-left--2 ds-u-fill--gray-lightest ds-u-display--block",
1523
- headerFilterClassName: "ds-u-padding-top--1 ds-u-fill--gray-lightest",
1524
- headerFilterCellClassName: "ds-u-padding-x--1 ds-u-padding-bottom--0 ds-u-border-bottom--0 ds-u-fill--gray-lightest",
1525
- columnIsSortedClassName: "dc-c-sort dc-c-sort--default",
1526
- columnIsSortedAscClassName: "dc-c-sort dc-c-sort--asc",
1527
- columnIsSortedDecClassName: "dc-c-sort dc-c-sort--desc",
1528
- tableColumnResizer: "dc-c-resize-handle",
1529
- tableColumnIsResizing: "isResizing",
1530
- ...customClasses
1531
- };
1532
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1533
- id: "resource-preview",
1534
- className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
1535
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
1536
- // filterTitle="Filter columns"
1537
- data: resource.values,
1538
- allowOverflow: allowOverflow,
1539
- sortDefaults: defaultSort,
1540
- columns: customColumns ? customColumns : $626282d9a03c51d5$export$1147582dfae658c6(resource.columns, resource.schema[id]),
1541
- // schema={resource.schema}
1542
- // totalRows={parseInt(resource.totalRows)}
1543
- // limit={resource.limit}
1544
- // offset={resource.offset}
1545
- // loading={resource.loading}
1546
- setSort: resource.setSort,
1547
- // setConditions={resource.setConditions}
1548
- // conditionsTransform={transformTableFilterToQueryCondition}
1549
- sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
1550
- tablePadding: tablePadding,
1551
- className: "dc-c-datatable",
1552
- customColumnFilter: $626282d9a03c51d5$var$DefaultColumnFilter,
1553
- options: options,
1554
- CustomLoadingComponent: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1555
- className: "ds-u-display--flex ds-u-padding--3",
1556
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
1557
- className: "ds-u-valign--middle",
1558
- role: "status",
1559
- "aria-valuetext": "Datatable loading"
1560
- })
1561
- }),
1562
- CustomNoResults: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1563
- className: "ds-u-display--flex ds-u-padding--3",
1564
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1565
- children: "No results returned."
1566
- })
1567
- })
1568
- })
1569
- });
1570
- };
1571
- $626282d9a03c51d5$var$ResourcePreview.defaultProps = {
1572
- options: {
1573
- layout: "flex",
1574
- columnFilter: false,
1575
- columnSort: true,
1576
- columnResize: true
1577
- },
1578
- truncateCellHeader: true,
1579
- defaultSort: [],
1580
- allowOverflow: true
1581
- };
1582
- var $626282d9a03c51d5$export$2e2bcd8739ae039 = $626282d9a03c51d5$var$ResourcePreview;
1583
-
1584
-
1585
-
1586
-
1587
-
1588
-
1589
-
1590
-
1591
-
1592
-
1593
-
1594
- const $2ed0091f7e32d1e6$var$DataTablePageResults = ({ totalRows: totalRows , limit: limit , offset: offset , className: className })=>{
1595
- const numTotalRows = totalRows;
1596
- if (numTotalRows === 0) return /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1597
- className: className,
1598
- children: `0 - 0 of 0 rows`
1599
- });
1600
- const ofTotal = ()=>{
1601
- if (limit >= numTotalRows) return numTotalRows;
1602
- if (limit + offset >= numTotalRows) return numTotalRows;
1603
- if (offset === 0) return limit;
1604
- return offset + limit;
1605
- };
1606
- const page = offset / limit;
1607
- const startTotal = ()=>page * limit + 1;
1608
- return /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1609
- className: className,
1610
- children: `${startTotal().toLocaleString()} - ${ofTotal().toLocaleString()} of ${numTotalRows.toLocaleString()} rows`
1611
- });
1612
- };
1613
- $2ed0091f7e32d1e6$var$DataTablePageResults.defaultProps = {
1614
- className: "data-table-results"
1615
- };
1616
- $2ed0091f7e32d1e6$var$DataTablePageResults.propTypes = {
1617
- className: (0, $hgUW1$proptypes).string,
1618
- totalRows: (0, $hgUW1$proptypes).number.isRequired,
1619
- limit: (0, $hgUW1$proptypes).number.isRequired,
1620
- offset: (0, $hgUW1$proptypes).number.isRequired
1621
- };
1622
- var $2ed0091f7e32d1e6$export$2e2bcd8739ae039 = $2ed0091f7e32d1e6$var$DataTablePageResults;
1623
-
1624
-
1625
-
1626
-
1627
-
1628
-
1629
-
1630
-
1631
- const $1e012d1e3b534af0$var$DataTableDensity = ({ setTablePadding: setTablePadding , tablePadding: tablePadding })=>{
1632
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1633
- className: "ds-u-display--flex",
1634
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
1635
- options: [
1636
- {
1637
- label: "Tight",
1638
- value: "ds-u-padding-y--0"
1639
- },
1640
- {
1641
- label: "Normal",
1642
- value: "ds-u-padding-y--1"
1643
- },
1644
- {
1645
- label: "Expanded",
1646
- value: "ds-u-padding-y--2"
1647
- }
1648
- ],
1649
- size: "small",
1650
- label: "Display density:",
1651
- labelClassName: "ds-u-margin-top--0",
1652
- name: "datatable_display_density",
1653
- onChange: (e)=>setTablePadding(e.target.value),
1654
- defaultValue: "ds-u-padding-y--1"
1655
- })
1656
- });
1657
- };
1658
- $1e012d1e3b534af0$var$DataTableDensity.propTypes = {
1659
- setTablePadding: (0, $hgUW1$proptypes).func.isRequired
1660
- };
1661
- var $1e012d1e3b534af0$export$2e2bcd8739ae039 = $1e012d1e3b534af0$var$DataTableDensity;
1662
-
1663
-
1664
-
1665
-
1666
-
1667
- const $e71aee394fdad8bd$var$ManageColumns = ()=>{
1668
- const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
1669
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
1670
- onClick: ()=>setModalOpen(!modalOpen),
1671
- children: "Manage Columns"
1672
- });
1673
- };
1674
- var $e71aee394fdad8bd$export$2e2bcd8739ae039 = $e71aee394fdad8bd$var$ManageColumns;
1675
-
1676
-
1677
-
1678
-
1679
-
1680
-
1681
- const $4def8e29c2039eb8$var$DataTableRowChanger = ({ setLimit: setLimit , rowOptions: rowOptions , limit: limit })=>{
1682
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1683
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
1684
- options: rowOptions.map((row)=>({
1685
- label: row,
1686
- value: row
1687
- })),
1688
- size: "small",
1689
- label: "Rows per page:",
1690
- labelClassName: "ds-u-margin-top--0",
1691
- name: "datatable_rows_per_page",
1692
- onChange: (e)=>setLimit(e.target.value),
1693
- defaultValue: limit
1694
- })
1695
- });
1696
- };
1697
- $4def8e29c2039eb8$var$DataTableRowChanger.defaultProps = {
1698
- rowOptions: [
1699
- 10,
1700
- 25,
1701
- 50,
1702
- 100
1703
- ]
1704
- };
1705
- $4def8e29c2039eb8$var$DataTableRowChanger.propTypes = {
1706
- rowOptions: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).number),
1707
- setLimit: (0, $hgUW1$proptypes).func.isRequired
1708
- };
1709
- var $4def8e29c2039eb8$export$2e2bcd8739ae039 = $4def8e29c2039eb8$var$DataTableRowChanger;
1710
-
1711
-
1712
-
1713
-
1714
- const $e973bc477cdc2dc7$var$DownloadIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1715
- width: "15px",
1716
- height: "15px",
1717
- viewBox: "0 0 384 512",
1718
- version: "1.1",
1719
- xmlns: "http://www.w3.org/2000/svg",
1720
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1721
- children: [
1722
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1723
- children: "Download Icon"
1724
- }),
1725
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1726
- stroke: "none",
1727
- strokeWidth: "1",
1728
- fill: "none",
1729
- fillRule: "evenodd",
1730
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1731
- fill: "#112E51",
1732
- fillRule: "nonzero",
1733
- 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"
1734
- })
1735
- })
1736
- ]
1737
- });
1738
- var $e973bc477cdc2dc7$export$2e2bcd8739ae039 = $e973bc477cdc2dc7$var$DownloadIcon;
1739
-
1740
-
1741
-
1742
-
1743
- const $7ec5423a30aa3f61$var$CopyIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1744
- width: "15px",
1745
- height: "15px",
1746
- viewBox: "0 0 512 512",
1747
- version: "1.1",
1748
- xmlns: "http://www.w3.org/2000/svg",
1749
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1750
- children: [
1751
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1752
- children: "Copy Icon"
1753
- }),
1754
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1755
- stroke: "none",
1756
- strokeWidth: "1",
1757
- fill: "none",
1758
- fillRule: "evenodd",
1759
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1760
- fill: "#112E51",
1761
- fillRule: "nonzero",
1762
- 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"
1763
- })
1764
- })
1765
- ]
1766
- });
1767
- var $7ec5423a30aa3f61$export$2e2bcd8739ae039 = $7ec5423a30aa3f61$var$CopyIcon;
1768
-
1769
-
1770
-
1771
-
1772
- const $ec9e1550b0b034d0$var$SettingsIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
1773
- width: "15px",
1774
- height: "15px",
1775
- // viewBox="0 0 15 15"
1776
- viewBox: "0 0 512 512",
1777
- version: "1.1",
1778
- xmlns: "http://www.w3.org/2000/svg",
1779
- xmlnsXlink: "http://www.w3.org/1999/xlink",
1780
- children: [
1781
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1782
- children: "Settings Icon"
1783
- }),
1784
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
1785
- stroke: "none",
1786
- strokeWidth: "1",
1787
- fill: "none",
1788
- fillRule: "evenodd",
1789
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
1790
- fill: "#112E51",
1791
- fillRule: "nonzero",
1792
- 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"
1793
- })
1794
- })
1795
- ]
1796
- });
1797
- var $ec9e1550b0b034d0$export$2e2bcd8739ae039 = $ec9e1550b0b034d0$var$SettingsIcon;
1798
-
1799
-
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: [
1812
- {
1813
- name: "arrow",
1814
- options: {
1815
- element: arrowElement
1816
- }
1817
- }
1818
- ]
1819
- });
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",
1838
- children: [
1839
- /*#__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
- })
1846
- }),
1847
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1848
- className: "dc-c-resource-header--buttons",
1849
- children: [
1850
- includeDownload && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
1851
- 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
- ]
1864
- }),
1865
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
1866
- onOpen: ()=>{
1867
- navigator.clipboard.writeText(window.location.href);
1868
- },
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",
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"
1908
- })
1909
- ]
1910
- })
1911
- ]
1912
- })
1913
- ]
1914
- })
1915
- })
1916
- ]
1917
- });
1918
- };
1919
- var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHeader;
1920
-
1921
-
1922
-
1923
-
1924
-
1925
-
1926
-
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",
1930
- children: [
1931
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1932
- className: "ds-u-color--primary ds-u-font-size--h3 ds-u-margin-top--0 ds-u-margin-bottom--2",
1933
- children: "Tags"
1934
- }),
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--small 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))
1940
- ]
1941
- });
1942
- };
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;
1950
-
1951
-
1952
-
1953
-
1954
-
1955
- const $f341c2fd9bc53390$var$DatasetDownloads = ({ downloadURL: downloadURL , type: type })=>{
1956
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1957
- className: "ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
1958
- children: [
1959
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1960
- className: "ds-u-color--primary ds-u-font-size--h3 ds-u-margin-top--0 ds-u-margin-bottom--2 ds-u-padding-bottom--2 ds-u-border ds-u-border-bottom--1",
1961
- children: "Downloads"
1962
- }),
1963
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1964
- className: "ds-u-margin-bottom--1 ds-u-color--gray",
1965
- children: "Resource"
1966
- }),
1967
- /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1968
- href: downloadURL,
1969
- className: "ds-u-word-break",
1970
- children: [
1971
- "Download this resource (",
1972
- type,
1973
- ")"
1974
- ]
1975
- })
1976
- ]
1977
- });
1978
- };
1979
- $f341c2fd9bc53390$var$DatasetDownloads.propTypes = {
1980
- downloadURL: (0, $hgUW1$proptypes).string.isRequired,
1981
- type: (0, $hgUW1$proptypes).string.isRequired
1982
- };
1983
- var $f341c2fd9bc53390$export$2e2bcd8739ae039 = $f341c2fd9bc53390$var$DatasetDownloads;
1984
-
1985
-
1986
-
1987
-
1988
-
1989
-
1990
- function $5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo) {
1991
- const rows = [];
1992
- Object.keys(metadataMapping).forEach((d)=>{
1993
- if (!datasetInfo[d]) return null;
1994
- else rows.push(...metadataMapping[d](datasetInfo[d]));
1995
- });
1996
- return rows;
1997
- }
1998
- const $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation = ({ datasetInfo: datasetInfo , id: id , metadataMapping: metadataMapping })=>{
1999
- const [rows] = (0, $hgUW1$useState)($5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo));
2000
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2001
- className: "dc-c-additional-info-table ds-u-margin-bottom--6",
2002
- children: [
2003
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2004
- children: "Additional Information"
2005
- }),
2006
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
2007
- compact: true,
2008
- striped: true,
2009
- children: [
2010
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
2011
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2012
- children: [
2013
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2014
- children: "Field"
2015
- }),
2016
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2017
- children: "Value"
2018
- })
2019
- ]
2020
- })
2021
- }),
2022
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
2023
- children: rows.map((r)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2024
- children: [
2025
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2026
- children: r.label
2027
- }),
2028
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2029
- children: r.value
2030
- })
2031
- ]
2032
- }, `${r.label}_${id}`))
2033
- })
2034
- ]
2035
- })
2036
- ]
2037
- });
2038
- };
2039
- var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation;
2040
-
2041
-
2042
-
2043
-
2044
-
2045
-
2046
- const $072291d44ce1834a$var$ResourceFooter = ({ resource: resource })=>{
2047
- const { limit: limit , values: values , offset: offset , count: count , setOffset: setOffset } = resource;
2048
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2049
- children: values.length > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
2050
- id: "test-default",
2051
- currentPage: Number(offset) / limit + 1,
2052
- totalPages: Math.ceil(Number(count) / limit),
2053
- onPageChange: (evt, page)=>{
2054
- evt.preventDefault();
2055
- setOffset((page - 1) * limit);
2056
- },
2057
- renderHref: (page)=>{
2058
- return "";
2059
- }
2060
- })
2061
- });
2062
- };
2063
- var $072291d44ce1834a$export$2e2bcd8739ae039 = $072291d44ce1834a$var$ResourceFooter;
2064
-
2065
-
2066
-
2067
-
2068
-
2069
-
2070
- const $68eacd619bee0da7$var$ResourceInformation = ({ resource: resource })=>{
2071
- const { count: count , columns: columns } = resource;
2072
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2073
- className: "dc-c-resource-info-table",
2074
- children: [
2075
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2076
- children: "About this Resource"
2077
- }),
2078
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
2079
- compact: true,
2080
- striped: true,
2081
- children: [
2082
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2083
- children: [
2084
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2085
- component: "th",
2086
- scope: "row",
2087
- children: "Rows"
2088
- }),
2089
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2090
- align: "right",
2091
- children: parseInt(count).toLocaleString()
2092
- })
2093
- ]
2094
- }),
2095
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
2096
- children: [
2097
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2098
- component: "th",
2099
- scope: "row",
2100
- children: "Columns"
2101
- }),
2102
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
2103
- align: "right",
2104
- children: columns.length.toLocaleString()
2105
- })
2106
- ]
2107
- })
2108
- ]
2109
- })
2110
- ]
2111
- });
2112
- };
2113
- var $68eacd619bee0da7$export$2e2bcd8739ae039 = $68eacd619bee0da7$var$ResourceInformation;
2114
-
2115
-
2116
- // Example custom column headers, where only effective date has an ! at the end
2117
- // [
2118
- // {schema: 'date', Cell: ({ value }) => localeDate(value),},
2119
- // {accessor: 'effective_date',Cell: ({ value }) => localeDate(value) + '!',},
2120
- // ]
2121
- function $7264a673914aa746$export$8049e8f40a9bdfb8(customHeaders, columns, schema) {
2122
- return columns.map((column)=>{
2123
- const customAccessorIndex = customHeaders.findIndex((header)=>header.accessor === column);
2124
- const customSchemaIndex = customHeaders.findIndex((header)=>header.schema === schema.fields[column].mysql_type);
2125
- let newColumn = {};
2126
- // If specific accessor is passed, this will override a general mysql_type Cell rewrite.
2127
- if (customAccessorIndex > -1) {
2128
- newColumn.Header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2129
- newColumn.accessor = column;
2130
- newColumn.Cell = customHeaders[customAccessorIndex].Cell;
2131
- } else {
2132
- newColumn.Header = schema && schema.fields[column].description ? schema.fields[column].description : column;
2133
- newColumn.accessor = column;
2134
- if (customSchemaIndex > -1) newColumn.Cell = customHeaders[customSchemaIndex].Cell;
2135
- }
2136
- return newColumn;
2137
- });
2138
- }
2139
- function $7264a673914aa746$export$e284ae5d89467c8f(date) {
2140
- if (!date) return date;
2141
- date = new Date(date);
2142
- date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
2143
- return date;
2144
- }
2145
- function $7264a673914aa746$export$6b5e57d20078142b(value, operator) {
2146
- let newValue = value;
2147
- if (Array.isArray(newValue)) newValue = newValue.join(",");
2148
- // return newValue.replace(/(^\%+|\%+$)/gm, '');
2149
- return newValue;
2150
- }
2151
- const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
2152
- {
2153
- label: "Is",
2154
- value: "="
2155
- },
2156
- {
2157
- label: "Starts With",
2158
- value: "starts with"
2159
- },
2160
- {
2161
- label: "Contains",
2162
- value: "contains"
2163
- },
2164
- {
2165
- label: "Is Not",
2166
- value: "<>"
2167
- },
2168
- {
2169
- label: "Or",
2170
- value: "in"
2171
- },
2172
- {
2173
- label: "Is",
2174
- value: "="
2175
- },
2176
- {
2177
- label: "Is Not",
2178
- value: "<>"
2179
- },
2180
- {
2181
- label: "Greater Than",
2182
- value: ">"
2183
- },
2184
- {
2185
- label: "Less Than",
2186
- value: "<"
2187
- }
2188
- ];
2189
- function $7264a673914aa746$export$2b9377795161999(type) {
2190
- switch(type){
2191
- case "text":
2192
- case "string":
2193
- return [
2194
- {
2195
- label: "Is",
2196
- value: "="
2197
- },
2198
- {
2199
- label: "Starts With",
2200
- value: "starts with"
2201
- },
2202
- {
2203
- label: "Contains",
2204
- value: "contains"
2205
- },
2206
- {
2207
- label: "Is Not",
2208
- value: "<>"
2209
- },
2210
- {
2211
- label: "Or",
2212
- value: "in"
2213
- }
2214
- ];
2215
- case "date":
2216
- return [
2217
- {
2218
- label: "Is",
2219
- value: "="
2220
- },
2221
- {
2222
- label: "Is Not",
2223
- value: "<>"
2224
- },
2225
- {
2226
- label: "Greater Than",
2227
- value: ">"
2228
- },
2229
- {
2230
- label: "Less Than",
2231
- value: "<"
2232
- }
2233
- ];
2234
- default:
2235
- // These 2 should be safe for all data types
2236
- return [
2237
- {
2238
- label: "Is",
2239
- value: "="
2240
- },
2241
- {
2242
- label: "Is Not",
2243
- value: "<>"
2244
- }
2245
- ];
2246
- }
2247
- }
2248
-
2249
-
2250
-
2251
- const $766b8e351dd607f5$var$DatasetBody = ({ rootUrl: rootUrl , id: id , dataset: dataset , additionalParams: additionalParams , customColumns: customColumns , columnSettings: columnSettings , columnWidths: columnWidths , metadataMapping: metadataMapping })=>{
2252
- let apiDocs = (0, $hgUW1$useRef)();
2253
- const [tablePadding, setTablePadding] = (0, $hgUW1$useState)("ds-u-padding-y--1");
2254
- const [fileFormat, setFileFormat] = (0, $hgUW1$useState)("");
2255
- let distribution = {};
2256
- let distribution_array = dataset.distribution ? dataset.distribution : [];
2257
- if (distribution_array.length) distribution = distribution_array[0];
2258
- const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
2259
- limit: 10,
2260
- manual: true
2261
- }, additionalParams);
2262
- (0, $hgUW1$useEffect)(()=>{
2263
- if (distribution.identifier) {
2264
- let localFileFormat = "";
2265
- if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
2266
- else if (distribution.data.mediaType) {
2267
- const mediaType = distribution.data.mediaType.split("/");
2268
- if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
2269
- }
2270
- setFileFormat(localFileFormat);
2271
- if (localFileFormat === "CSV") {
2272
- resource.setResource(distribution.identifier);
2273
- resource.setManual(false);
2274
- }
2275
- }
2276
- }, [
2277
- distribution
2278
- ]);
2279
- return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
2280
- className: "ds-l-container",
2281
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2282
- className: "ds-l-row ds-u-padding-top--3",
2283
- children: [
2284
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2285
- className: "ds-l-md-col--9 ds-l-sm-col--12",
2286
- children: [
2287
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
2288
- className: "ds-title ds-u-word-break",
2289
- children: dataset.title
2290
- }),
2291
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2292
- className: "ds-l-row",
2293
- children: [
2294
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2295
- className: "ds-l-col--6",
2296
- children: dataset.theme ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
2297
- variation: "info",
2298
- children: dataset.theme[0].data
2299
- }) : null
2300
- }),
2301
- dataset.modified && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2302
- className: "ds-l-col--6 ds-u-color--gray ds-u-text-align--right",
2303
- children: [
2304
- "Updated ",
2305
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2306
- date: dataset.modified
2307
- })
2308
- ]
2309
- })
2310
- ]
2311
- }),
2312
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2313
- className: "dc-c-metadata-description",
2314
- dangerouslySetInnerHTML: {
2315
- __html: dataset.description
2316
- }
2317
- }),
2318
- resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2319
- children: [
2320
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2321
- className: "dc-resource-header",
2322
- children: "Resource Preview"
2323
- }),
2324
- resource.columns ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2325
- children: [
2326
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $af099c546cb226c7$export$2e2bcd8739ae039), {
2327
- id: id,
2328
- includeFiltered: true,
2329
- includeDensity: true,
2330
- tablePadding: tablePadding,
2331
- setTablePadding: setTablePadding,
2332
- distribution: distribution,
2333
- resource: resource
2334
- }),
2335
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $626282d9a03c51d5$export$2e2bcd8739ae039), {
2336
- id: distribution.identifier,
2337
- tablePadding: tablePadding,
2338
- resource: resource,
2339
- customColumns: (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution_array[0].identifier]),
2340
- columnSettings: columnSettings,
2341
- options: {
2342
- layout: "flex",
2343
- columnFilter: false,
2344
- columnSort: true,
2345
- columnResize: true
2346
- },
2347
- columnWidths: columnWidths
2348
- }),
2349
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $072291d44ce1834a$export$2e2bcd8739ae039), {
2350
- resource: resource
2351
- }),
2352
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $68eacd619bee0da7$export$2e2bcd8739ae039), {
2353
- resource: resource
2354
- })
2355
- ]
2356
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)(Spinner, {
2357
- "aria-valuetext": "Dataset loading",
2358
- role: "status"
2359
- })
2360
- ]
2361
- }) : "",
2362
- dataset.identifier && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5644ebd2c3dbfd7b$export$2e2bcd8739ae039), {
2363
- datasetInfo: dataset,
2364
- id: dataset.identifier,
2365
- metadataMapping: metadataMapping
2366
- }),
2367
- Object.keys(distribution).length && fileFormat === "CSV" && dataset.identifier ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2368
- ref: apiDocs,
2369
- children: [
2370
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2371
- children: "Try the API"
2372
- }),
2373
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
2374
- url: `${rootUrl}/metastore/schemas/dataset/items/${dataset.identifier}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
2375
- docExpansion: "list",
2376
- defaultModelsExpandDepth: -1
2377
- })
2378
- ]
2379
- }) : ""
2380
- ]
2381
- }),
2382
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2383
- className: "ds-l-md-col--3 ds-l-sm-col--12",
2384
- children: [
2385
- Object.keys(distribution).length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f341c2fd9bc53390$export$2e2bcd8739ae039), {
2386
- downloadURL: distribution.data.downloadURL,
2387
- type: fileFormat
2388
- }) : "",
2389
- dataset.keyword && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $17193a17e26a72da$export$2e2bcd8739ae039), {
2390
- keywords: dataset.keyword
2391
- }),
2392
- Object.keys(distribution).length && fileFormat === "CSV" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2393
- className: "dc-c-dataset-tags ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
2394
- children: [
2395
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
2396
- className: "ds-u-color--primary ds-u-font-size--h3 ds-u-margin-top--0 ds-u-margin-bottom--2 ds-u-padding-bottom--2",
2397
- children: "API"
2398
- }),
2399
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2400
- variation: "ghost",
2401
- onClick: ()=>window.scrollTo({
2402
- behavior: "smooth",
2403
- top: apiDocs.current.offsetTop
2404
- }),
2405
- children: "Scroll to dataset API"
2406
- })
2407
- ]
2408
- }) : ""
2409
- ]
2410
- })
2411
- ]
2412
- })
2413
- });
2414
- };
2415
- $766b8e351dd607f5$var$DatasetBody.propTypes = {
2416
- id: (0, $hgUW1$proptypes).string.isRequired,
2417
- dataset: (0, $hgUW1$proptypes).object.isRequired
2418
- };
2419
- var $766b8e351dd607f5$export$2e2bcd8739ae039 = $766b8e351dd607f5$var$DatasetBody;
2420
-
2421
-
2422
-
2423
-
2424
-
2425
-
2426
-
2427
- const $28f16f59778efa64$export$82b1b1d517e5388a = {
2428
- "R/P10Y": {
2429
- name: "Decennial"
2430
- },
2431
- "R/P4Y": {
2432
- name: "Quadrennial"
2433
- },
2434
- "R/P1Y": {
2435
- name: "Annual"
2436
- },
2437
- "R/P2M": {
2438
- name: "Bimonthly"
2439
- },
2440
- "R/P3.5D": {
2441
- name: "Semiweekly"
2442
- },
2443
- "R/P1D": {
2444
- name: "Daily"
2445
- },
2446
- "R/P2W": {
2447
- name: "Biweekly"
2448
- },
2449
- "R/P6M": {
2450
- name: "Semiannual"
2451
- },
2452
- "R/P2Y": {
2453
- name: "Biennial"
2454
- },
2455
- "R/P3Y": {
2456
- name: "Triennial"
2457
- },
2458
- "R/P0.33W": {
2459
- name: "Three times a week"
2460
- },
2461
- "R/P0.33M": {
2462
- name: "Three times a month"
2463
- },
2464
- "R/PT1S": {
2465
- name: "Continuously updated"
2466
- },
2467
- "R/P1M": {
2468
- name: "Monthly"
2469
- },
2470
- "R/P3M": {
2471
- name: "Quarterly"
2472
- },
2473
- "R/P0.5M": {
2474
- name: "Semimonthly"
2475
- },
2476
- "R/P4M": {
2477
- name: "Three times a year"
2478
- },
2479
- "R/P1W": {
2480
- name: "Weekly"
2481
- },
2482
- "R/PT1H": {
2483
- name: "Hourly"
2484
- },
2485
- irregular: {
2486
- name: "Irregular"
2487
- }
2488
- };
2489
-
2490
-
2491
- const $6da0396069e23175$export$bc27cf7ecf44639d = {
2492
- modified: (data)=>{
2493
- return [
2494
- {
2495
- label: "Modified",
2496
- value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2497
- date: data
2498
- })
2499
- }
2500
- ];
2501
- },
2502
- issued: (data)=>{
2503
- return [
2504
- {
2505
- label: "Issued",
2506
- value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
2507
- date: data
2508
- })
2509
- }
2510
- ];
2511
- },
2512
- accrualPeriodicity: (data)=>{
2513
- return [
2514
- {
2515
- label: "Frequency",
2516
- value: (0, $28f16f59778efa64$export$82b1b1d517e5388a)[data].name
2517
- }
2518
- ];
2519
- },
2520
- publisher: (data)=>{
2521
- if (data.data && data.data.name) return [
2522
- {
2523
- label: "Publisher",
2524
- value: data.data.name
2525
- }
2526
- ];
2527
- else return [];
2528
- },
2529
- identifier: (data)=>{
2530
- return [
2531
- {
2532
- label: "Identifier",
2533
- value: data
2534
- }
2535
- ];
2536
- },
2537
- contactPoint: (data)=>{
2538
- let rows = [];
2539
- if (data.fn) rows.push({
2540
- label: "Contact",
2541
- value: data.fn
2542
- });
2543
- if (data.hasEmail) rows.push({
2544
- label: "Contact Email",
2545
- value: data.hasEmail
2546
- });
2547
- return rows;
2548
- },
2549
- bureauCode: (data)=>{
2550
- if (data.length) return [
2551
- {
2552
- label: "Bureau Code",
2553
- value: data[0]
2554
- }
2555
- ];
2556
- },
2557
- programCode: (data)=>{
2558
- if (data.length) return [
2559
- {
2560
- label: "Program Code",
2561
- value: data[0]
2562
- }
2563
- ];
2564
- },
2565
- theme: (data)=>{
2566
- return [
2567
- {
2568
- label: "Category",
2569
- value: data.map((theme)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
2570
- to: `/datasets?theme[]=${theme.data}`,
2571
- children: theme.data
2572
- }, theme.data)).reduce((prev, curr)=>[
2573
- prev,
2574
- ", ",
2575
- curr
2576
- ])
2577
- }
2578
- ];
2579
- },
2580
- keyword: (data)=>{
2581
- return [
2582
- {
2583
- label: "Tags",
2584
- value: data.map((keyword)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
2585
- to: `/datasets?keyword[]=${keyword.data}`,
2586
- children: keyword.data
2587
- }, keyword.data)).reduce((prev, curr)=>[
2588
- prev,
2589
- ", ",
2590
- curr
2591
- ])
2592
- }
2593
- ];
2594
- },
2595
- license: (data)=>{
2596
- return [
2597
- {
2598
- label: "License",
2599
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2600
- href: data,
2601
- children: data
2602
- })
2603
- }
2604
- ];
2605
- },
2606
- accessLevel: (data)=>{
2607
- return [
2608
- {
2609
- label: "Public Access Level",
2610
- value: data
2611
- }
2612
- ];
2613
- },
2614
- temporal: (data)=>{
2615
- return [
2616
- {
2617
- label: "Temporal Coverage",
2618
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2619
- className: "dc-c-word-break--all",
2620
- children: data
2621
- })
2622
- }
2623
- ];
2624
- },
2625
- spatial: (data)=>{
2626
- return [
2627
- {
2628
- label: "Spacial/Geographical Coverage",
2629
- value: data
2630
- }
2631
- ];
2632
- },
2633
- references: (data)=>{
2634
- return [
2635
- {
2636
- label: "Related Documents",
2637
- value: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2638
- className: "ds-u-margin--0 ds-u-padding-y--0 ds-u-padding-left--2 ds-u-padding-right--0",
2639
- children: data.map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
2640
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2641
- href: item,
2642
- children: item
2643
- })
2644
- }, item))
2645
- })
2646
- }
2647
- ];
2648
- }
2649
- };
2650
-
2651
-
2652
-
2653
- const $6e7bdcbebdb4b794$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalParams: additionalParams , customColumns: customColumns , setDatasetTitle: setDatasetTitle , columnSettings: columnSettings , columnWidths: columnWidths , customMetadataMapping: customMetadataMapping })=>{
2654
- const metastore = (0, $68d79598b83f3382$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
2655
- const { dataset: dataset } = metastore;
2656
- const title = dataset.title ? dataset.title : "";
2657
- const metadataMapping = {
2658
- ...(0, $6da0396069e23175$export$bc27cf7ecf44639d),
2659
- ...customMetadataMapping
2660
- };
2661
- (0, $hgUW1$useEffect)(()=>{
2662
- if (title) {
2663
- if (setDatasetTitle) setDatasetTitle(title);
2664
- }
2665
- }, [
2666
- title
2667
- ]);
2668
- const notFoundContent = /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2669
- className: "ds-u-padding-top--3",
2670
- children: [
2671
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
2672
- className: "ds-title",
2673
- children: "Error: Dataset not found"
2674
- }),
2675
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2676
- children: "We're sorry, but there is no dataset ID that matches your entry. You may have been directed here because:"
2677
- }),
2678
- /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
2679
- children: [
2680
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
2681
- children: "The address you typed contains a typo;"
2682
- }),
2683
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
2684
- children: "The requested dataset no longer exists."
2685
- })
2686
- ]
2687
- }),
2688
- /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2689
- children: [
2690
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2691
- className: "ds-u-font-weight--bold",
2692
- children: "Note:"
2693
- }),
2694
- " If you were using a bookmark, please reset it once you find the correct dataset."
2695
- ]
2696
- })
2697
- ]
2698
- });
2699
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2700
- children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
2701
- content: notFoundContent
2702
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $766b8e351dd607f5$export$2e2bcd8739ae039), {
2703
- rootUrl: rootUrl,
2704
- id: id,
2705
- dataset: dataset,
2706
- additionalParams: additionalParams,
2707
- customColumns: customColumns ? customColumns : [],
2708
- columnSettings: columnSettings,
2709
- columnWidths: columnWidths,
2710
- metadataMapping: metadataMapping
2711
- })
2712
- });
2713
- };
2714
- $6e7bdcbebdb4b794$var$Dataset.propTypes = {
2715
- id: (0, $hgUW1$proptypes).string.isRequired,
2716
- rootUrl: (0, $hgUW1$proptypes).string.isRequired
2717
- };
2718
- var $6e7bdcbebdb4b794$export$2e2bcd8739ae039 = $6e7bdcbebdb4b794$var$Dataset;
2719
-
2720
-
2721
-
2722
-
2723
-
2724
-
2725
-
2726
-
2727
-
2728
-
2729
-
2730
-
2731
-
2732
-
2733
-
2734
-
2735
-
2736
- const $e5bfafc6d4e6f207$var$SearchModal = ({ searchFunc: searchFunc , appNodeId: appNodeId , searchModalText: searchModalText , buttonSize: buttonSize , inversedModalButton: inversedModalButton , inversedSearchButton: inversedSearchButton })=>{
2737
- const navigate = (0, $hgUW1$useNavigate)();
2738
- const [modalSearchTerm, setModalSearchTerm] = (0, $hgUW1$useState)("");
2739
- const [modalSearch, setModalSearch] = (0, $hgUW1$useState)(false);
2740
- const mobile = (0, $hgUW1$useMediaQuery)({
2741
- minWidth: 0,
2742
- maxWidth: 543
2743
- });
2744
- function searchForDataset(e) {
2745
- e.preventDefault();
2746
- if (window) {
2747
- if (window.location.pathname !== "/datasets") navigate(`/datasets?fulltext=${modalSearchTerm}`);
2748
- else {
2749
- window.location.search = `fulltext=${modalSearchTerm}`;
2750
- setModalSearch(false);
2751
- }
2752
- }
2753
- }
2754
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2755
- children: [
2756
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2757
- variation: "ghost",
2758
- onDark: inversedSearchButton,
2759
- size: buttonSize,
2760
- className: "ds-u-border--0 dc-c-search-modal--button",
2761
- onClick: ()=>setModalSearch(true),
2762
- children: mobile ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2763
- className: "ds-u-visibility--screen-reader",
2764
- children: "Search"
2765
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2766
- children: "Search"
2767
- })
2768
- }),
2769
- modalSearch && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
2770
- className: "dc-c-search-dialog",
2771
- onExit: ()=>setModalSearch(false),
2772
- getApplicationNode: ()=>document.getElementById(appNodeId),
2773
- closeButtonVariation: "primary",
2774
- closeButtonText: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2775
- children: "Close"
2776
- }),
2777
- children: [
2778
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2779
- children: searchModalText
2780
- }),
2781
- /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
2782
- className: "ds-u-display--flex ds-u-align-items--stretch ds-u-flex-wrap--nowrap",
2783
- onSubmit: (e)=>{
2784
- searchForDataset(e);
2785
- },
2786
- children: [
2787
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
2788
- value: modalSearchTerm,
2789
- fieldClassName: "ds-u-display--inline-block",
2790
- className: "ds-l-col--9",
2791
- label: "Search Term",
2792
- name: "search-modal",
2793
- labelClassName: "ds-u-visibility--screen-reader",
2794
- onChange: (e)=>setModalSearchTerm(e.target.value)
2795
- }),
2796
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
2797
- type: "submit",
2798
- onDark: inversedModalButton,
2799
- className: "ds-l-col--3",
2800
- children: [
2801
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2802
- className: "fas fa-search small-text ds-u-sm-display--none"
2803
- }),
2804
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2805
- className: "full-text ds-u-display--none ds-u-sm-display--inline-block",
2806
- children: "Search"
2807
- })
2808
- ]
2809
- })
2810
- ]
2811
- })
2812
- ]
2813
- })
2814
- ]
2815
- });
2816
- };
2817
- $e5bfafc6d4e6f207$var$SearchModal.defaultProps = {
2818
- appNodeId: "App",
2819
- buttonSize: null,
2820
- inversedModalButton: true,
2821
- inversedSearchButton: true
2822
- };
2823
- var $e5bfafc6d4e6f207$export$2e2bcd8739ae039 = $e5bfafc6d4e6f207$var$SearchModal;
2824
-
2825
-
2826
- var $52466563e0d69ea8$exports = {};
2827
- $52466563e0d69ea8$exports = new URL("CMSGovLogo-O.90ce815c.png", import.meta.url).toString();
2828
-
2829
-
2830
- const $2db98b8f69058a30$var$DesktopHeader = ({ siteName: siteName , headerClasses: headerClasses , linkClasses: linkClasses , links: links , org: org , searchModalText: searchModalText , customSearch: customSearch , includeTopNav: includeTopNav , inversedModalButton: inversedModalButton , inversedSearchButton: inversedSearchButton })=>{
2831
- const { url: url , tagline: tagline , logo: logo , urlTitle: urlTitle , logoAltText: logoAltText } = org;
2832
- const headerClassString = headerClasses ?? "dc-c-header ds-base";
2833
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("header", {
2834
- className: headerClassString,
2835
- "aria-label": "Site header",
2836
- children: [
2837
- includeTopNav && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2838
- className: "dc-c-cmsheader ds-u-display--flex ds-u-padding-x--5 ds-u-align-items--center",
2839
- children: [
2840
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2841
- className: "ds-l-sm-col--12 ds-l-lg-col--8",
2842
- children: [
2843
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2844
- className: "cms-link-container",
2845
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2846
- href: url,
2847
- title: urlTitle,
2848
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("img", {
2849
- src: logo,
2850
- alt: logoAltText
2851
- })
2852
- })
2853
- }),
2854
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2855
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2856
- className: "cms-text-container",
2857
- children: tagline
2858
- })
2859
- })
2860
- ]
2861
- }),
2862
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2863
- className: "ds-u-margin-left--auto",
2864
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f57121650539d8c5$export$2e2bcd8739ae039), {
2865
- links: links.topnav,
2866
- menuName: "CMS Main Header",
2867
- menuId: "cmsheader",
2868
- menuClasses: "ds-u-display--flex dc-c-header--links ds-u-font-size--small"
2869
- })
2870
- })
2871
- ]
2872
- }),
2873
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2874
- className: "dc-c-main-navigation",
2875
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2876
- className: "ds-l-container",
2877
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2878
- className: "ds-l-row ds-u-align-items--center",
2879
- children: [
2880
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2881
- className: "ds-u-margin-right--5 ds-u-padding-y--3 dc-c-site-title",
2882
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
2883
- className: "ds-c-link--inverse ds-h1",
2884
- to: "/",
2885
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2886
- className: "",
2887
- children: siteName
2888
- })
2889
- })
2890
- }),
2891
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f57121650539d8c5$export$2e2bcd8739ae039), {
2892
- links: links.main,
2893
- wrapLabel: true,
2894
- menuName: "CMS Site Main Nav",
2895
- menuId: "site",
2896
- menuClasses: "ds-u-display--flex dc-c-header--links ds-u-align-items--center",
2897
- linkClasses: linkClasses
2898
- }),
2899
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2900
- className: "dc-c-main-navigation--search ds-u-margin-left--auto ds-u-lg-padding-left--1 ds-u-xl-padding-left--3",
2901
- children: customSearch ? customSearch : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e5bfafc6d4e6f207$export$2e2bcd8739ae039), {
2902
- searchModalText: searchModalText,
2903
- inversedModalButton: inversedModalButton,
2904
- inversedSearchButton: inversedSearchButton
2905
- })
2906
- })
2907
- ]
2908
- })
2909
- })
2910
- })
2911
- ]
2912
- });
2913
- };
2914
- $2db98b8f69058a30$var$DesktopHeader.defaultProps = {
2915
- org: {
2916
- tagline: "The Centers for Medicare & Medicaid Services",
2917
- url: "https://cms.gov",
2918
- urlTitle: "CMS.gov Centers for Medicare & Medicaid Services",
2919
- logo: (0, (/*@__PURE__*/$parcel$interopDefault($52466563e0d69ea8$exports))),
2920
- logoAltText: "CMS.gov Centers for Medicare & Medicaid Services"
2921
- },
2922
- includeTopNav: true,
2923
- customSearch: false,
2924
- linkClasses: "ds-u-xl-margin-right--4 ds-u-margin-right--3 ds-u-padding-y--3"
2925
- };
2926
- $2db98b8f69058a30$var$DesktopHeader.propTypes = {
2927
- siteName: (0, $hgUW1$proptypes).node.isRequired,
2928
- includeTopNav: (0, $hgUW1$proptypes).bool,
2929
- linkClasses: (0, $hgUW1$proptypes).string
2930
- };
2931
- var $2db98b8f69058a30$export$2e2bcd8739ae039 = $2db98b8f69058a30$var$DesktopHeader;
2932
-
2933
-
2934
-
2935
-
2936
-
2937
-
2938
-
2939
-
2940
-
2941
-
2942
-
2943
-
2944
- var $972485213997ff8b$exports = {};
2945
- $972485213997ff8b$exports = new URL("CMSgov@2x-white-O.78cd05d3.png", import.meta.url).toString();
2946
-
2947
-
2948
- const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links , org: org , searchModalText: searchModalText , customSearch: customSearch = false , includeTopNav: includeTopNav , inversedModalButton: inversedModalButton , inversedSearchButton: inversedSearchButton })=>{
2949
- const { url: url , logo: logo , urlTitle: urlTitle , logoAltText: logoAltText , inverseLogo: inverseLogo } = org;
2950
- const [menuOpen, setMenuOpen] = (0, $hgUW1$useState)(false);
2951
- const mobile = (0, $hgUW1$useMediaQuery)({
2952
- minWidth: 0,
2953
- maxWidth: 543
2954
- });
2955
- const tablet = (0, $hgUW1$useMediaQuery)({
2956
- minWidth: 544,
2957
- maxWidth: 1023
2958
- });
2959
- const menu = (0, $hgUW1$useRef)(null);
2960
- (0, $hgUW1$useEffect)(()=>{
2961
- function handleFocusOut(event) {
2962
- if (menu.current && !menu.current.contains(event.relatedTarget)) setMenuOpen(false);
2963
- }
2964
- function handleClick(event) {
2965
- // Links are wrapped in spans, this checks if the parent is an A, also check if in the search modal.
2966
- if (event.target.parentElement.nodeName === "A" || event.target.closest(".dc-c-search-dialog")) setMenuOpen(false);
2967
- }
2968
- function handleSearchEnter(event) {
2969
- // Close upon user hiting enter on search.
2970
- if (event.keyCode === 13) setMenuOpen(false);
2971
- }
2972
- menu.current.addEventListener("focusout", handleFocusOut);
2973
- document.addEventListener("mousedown", handleClick);
2974
- document.addEventListener("keyup", handleSearchEnter);
2975
- return ()=>{
2976
- document.removeEventListener("keyup", handleSearchEnter);
2977
- document.removeEventListener("mousedown", handleClick);
2978
- if (menu.current) menu.current.removeEventListener("focusout", handleFocusOut);
2979
- };
2980
- }, [
2981
- menu.current,
2982
- menuOpen
2983
- ]);
2984
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("header", {
2985
- className: `dc-c-header dc-c-mobile-header ${menuOpen ? "menu-open" : ""}`,
2986
- "aria-label": "Site header",
2987
- children: [
2988
- includeTopNav && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2989
- className: `dc-c-cmsheader ds-u-display--flex ds-u-padding-x--1 ds-u-align-items--center ${mobile ? "ds-u-justify-content--center" : "ds-u-justify-content--between"}`,
2990
- children: [
2991
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2992
- className: "cms-link-container",
2993
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
2994
- href: url,
2995
- title: urlTitle,
2996
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("img", {
2997
- src: menuOpen ? inverseLogo : logo,
2998
- alt: logoAltText
2999
- })
3000
- })
3001
- }),
3002
- tablet && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3003
- className: "ds-u-margin-left--auto",
3004
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f57121650539d8c5$export$2e2bcd8739ae039), {
3005
- links: links.topnav,
3006
- menuName: "CMS Main Header",
3007
- menuId: "cmsheader",
3008
- menuClasses: "ds-u-display--flex dc-c-header--links ds-u-font-size--small"
3009
- })
3010
- })
3011
- ]
3012
- }),
3013
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3014
- className: "dc-c-main-navigation ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center",
3015
- children: [
3016
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3017
- variation: "ghost",
3018
- onDark: true,
3019
- size: "small",
3020
- className: "dc-c-mobile-menu--open",
3021
- onClick: ()=>setMenuOpen(true),
3022
- children: mobile ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3023
- className: "ds-u-visibility--screen-reader",
3024
- children: "Menu"
3025
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
3026
- children: "Menu"
3027
- })
3028
- }),
3029
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3030
- className: "ds-u-padding-y--3 dc-c-site-title",
3031
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
3032
- to: "/",
3033
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3034
- className: "ds-h1",
3035
- children: siteName
3036
- })
3037
- })
3038
- }),
3039
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3040
- className: "dc-c-mobile-menu--search",
3041
- children: customSearch ? customSearch : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e5bfafc6d4e6f207$export$2e2bcd8739ae039), {
3042
- searchFunc: (e)=>{
3043
- e.preventDefault();
3044
- },
3045
- searchModalText: searchModalText,
3046
- buttonSize: "small",
3047
- inversedModalButton: inversedModalButton,
3048
- inversedSearchButton: inversedSearchButton
3049
- })
3050
- })
3051
- ]
3052
- }),
3053
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3054
- className: "dc-c-mobile-header--menu",
3055
- ref: menu,
3056
- children: [
3057
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3058
- className: "ds-u-display--flex dc-c-mobile-header--menu-close ds-u-justify-content--between",
3059
- children: [
3060
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3061
- variation: "ghost",
3062
- onDark: true,
3063
- size: "small",
3064
- className: "dc-c-mobile-menu--close ds-u-margin-left--1 ds-u-padding-left--0",
3065
- onClick: ()=>setMenuOpen(false),
3066
- children: "Close"
3067
- }),
3068
- tablet && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3069
- className: "dc-c-mobile-menu--search",
3070
- children: customSearch ? customSearch : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e5bfafc6d4e6f207$export$2e2bcd8739ae039), {
3071
- searchFunc: (e)=>{
3072
- e.preventDefault();
3073
- },
3074
- searchModalText: searchModalText,
3075
- buttonSize: "small"
3076
- })
3077
- })
3078
- ]
3079
- }),
3080
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f57121650539d8c5$export$2e2bcd8739ae039), {
3081
- links: links.main,
3082
- wrapLabel: true,
3083
- menuName: "CMS Site Main Nav",
3084
- menuId: "site",
3085
- menuClasses: "dc-c-header--links dc-c-header--mobile-links",
3086
- linkClasses: "ds-u-margin-left--1 ds-u-padding-bottom--2 ds-h5"
3087
- }),
3088
- mobile && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3089
- className: "cms-mobile-header--container",
3090
- children: [
3091
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {}),
3092
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f57121650539d8c5$export$2e2bcd8739ae039), {
3093
- links: links.topnav,
3094
- menuName: "CMS Main Header",
3095
- menuId: "cms-mobile-header",
3096
- linkClasses: "ds-u-margin-left--1 ds-u-margin-bottom--2",
3097
- menuClasses: "dc-c-header--links ds-u-font-size--small"
3098
- })
3099
- ]
3100
- })
3101
- ]
3102
- })
3103
- ]
3104
- });
3105
- };
3106
- $caaccb8ea608e518$var$MobileHeader.defaultProps = {
3107
- org: {
3108
- tagline: "The Centers for Medicare and Medicaid Services",
3109
- url: "https://cms.gov",
3110
- urlTitle: "CMS.gov Centers for Medicare &amp; Medicaid Services",
3111
- logo: (0, (/*@__PURE__*/$parcel$interopDefault($52466563e0d69ea8$exports))),
3112
- logoAltText: "CMS.gov Centers for Medicare &amp; Medicaid Services",
3113
- inverseLogo: (0, (/*@__PURE__*/$parcel$interopDefault($972485213997ff8b$exports)))
3114
- },
3115
- includeTopNav: true
3116
- };
3117
- var $caaccb8ea608e518$export$2e2bcd8739ae039 = $caaccb8ea608e518$var$MobileHeader;
3118
-
3119
-
3120
-
3121
-
3122
-
3123
- const $a5a6a06d249c33b8$var$Header = ({ mobileMaxWidth: mobileMaxWidth , desktopMinWidth: desktopMinWidth , siteName: siteName , links: links , org: org , includeTopNav: includeTopNav })=>{
3124
- const mobile = (0, $hgUW1$useMediaQuery)({
3125
- minWidth: 0,
3126
- maxWidth: mobileMaxWidth
3127
- });
3128
- const desktop = (0, $hgUW1$useMediaQuery)({
3129
- minWidth: desktopMinWidth
3130
- });
3131
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3132
- children: [
3133
- desktop && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2db98b8f69058a30$export$2e2bcd8739ae039), {
3134
- siteName: siteName,
3135
- links: links,
3136
- org: org,
3137
- includeTopNav: includeTopNav
3138
- }),
3139
- mobile && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $caaccb8ea608e518$export$2e2bcd8739ae039), {
3140
- siteName: siteName,
3141
- links: links,
3142
- org: org,
3143
- includeTopNav: includeTopNav
3144
- })
3145
- ]
3146
- });
3147
- };
3148
- $a5a6a06d249c33b8$var$Header.defaultProps = {
3149
- mobileMaxWidth: 1023,
3150
- desktopMinWidth: 1024,
3151
- includeTopNav: true
3152
- };
3153
- var $a5a6a06d249c33b8$export$2e2bcd8739ae039 = $a5a6a06d249c33b8$var$Header;
3154
-
3155
-
3156
-
3157
-
3158
-
3159
-
3160
-
3161
-
3162
-
3163
-
3164
-
3165
- const $a6df0aa147323304$var$Footer = ({ links: links , showEmail: showEmail , emailTitle: emailTitle , emailBody: emailBody , emailLink: emailLink , emailButton: emailButton , socialMediaLinks: socialMediaLinks , hhsLogo: hhsLogo , cmsLogo: cmsLogo , trademarkContent: trademarkContent })=>{
3166
- const xs = (0, $hgUW1$useMediaQuery)({
3167
- minWidth: 0,
3168
- maxWidth: 544
3169
- });
3170
- const sm = (0, $hgUW1$useMediaQuery)({
3171
- minWidth: 544,
3172
- maxWidth: 768
3173
- });
3174
- const md = (0, $hgUW1$useMediaQuery)({
3175
- minWidth: 768
3176
- });
3177
- const { footerOpenDataToolLinks: footerOpenDataToolLinks , footerAdditionalResourcesLinks: footerAdditionalResourcesLinks , footerUtilityLinks: footerUtilityLinks } = links;
3178
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("footer", {
3179
- className: "dc-c-footer",
3180
- children: [
3181
- showEmail && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3182
- className: "dc-c-emailupdates",
3183
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3184
- className: "ds-l-container ds-u-padding-y--5",
3185
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3186
- className: "ds-l-row ds-u-align-items--center",
3187
- children: [
3188
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3189
- className: "ds-l-md-col--8",
3190
- children: [
3191
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3192
- className: "ds-h4",
3193
- children: emailTitle
3194
- }),
3195
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3196
- children: emailBody
3197
- })
3198
- ]
3199
- }),
3200
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3201
- className: "ds-l-md-col--4 ds-u-padding-left--7",
3202
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3203
- onDark: true,
3204
- variation: "solid",
3205
- href: emailLink,
3206
- children: emailButton
3207
- })
3208
- })
3209
- ]
3210
- })
3211
- })
3212
- }),
3213
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3214
- className: "dc-c-footer--middle-container",
3215
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3216
- className: `${md ? "ds-l-container" : ""}`,
3217
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3218
- className: "ds-l-row ds-u-margin--0",
3219
- children: [
3220
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3221
- className: `dc-c-footer__resources ds-l-md-col--7 ds-l-sm-col--12 ds-u-padding-top--7 ds-u-padding-bottom--4 ${md ? "ds-u-padding-x--0" : ""} ${sm ? "ds-u-padding-x--4" : ""}`,
3222
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3223
- className: "ds-l-lg-col--9 ds-l-md-col--11 ds-u-padding-x--0",
3224
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3225
- className: `ds-u-display--flex ${xs ? "ds-u-flex-direction--column" : "ds-u-flex-direction--row"}`,
3226
- children: [
3227
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3228
- className: "ds-u-margin-right--6 ds-u-margin-bottom--2",
3229
- children: [
3230
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3231
- className: "ds-h6 dc-footer--heading ds-u-margin-bottom--2",
3232
- children: "Open data tools"
3233
- }),
3234
- /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
3235
- className: "ds-u-font-size--small ds-u-margin-bottom--3",
3236
- children: footerOpenDataToolLinks.map((link)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3237
- className: "ds-u-margin-bottom--1",
3238
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
3239
- link: link,
3240
- className: "dc-menu-item"
3241
- })
3242
- }, link.id))
3243
- })
3244
- ]
3245
- }),
3246
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3247
- children: [
3248
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3249
- className: "ds-h6 dc-footer--heading ds-u-margin-bottom--2",
3250
- children: "Additional resources"
3251
- }),
3252
- /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
3253
- className: "ds-u-font-size--small",
3254
- children: footerAdditionalResourcesLinks.filter((link)=>{
3255
- const noOnClick = Object.keys(link).findIndex((l)=>l === "onClick");
3256
- if (noOnClick === -1 || link.onClick && link.dataTag) return link;
3257
- }).map((link)=>{
3258
- if (link.onClick && link.dataTag) return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3259
- className: "ds-u-margin-bottom--1",
3260
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
3261
- href: link.url,
3262
- ["data-" + link.dataTag.name]: link.dataTag.value,
3263
- onClick: link.onClick,
3264
- children: link.label
3265
- })
3266
- }, link.id);
3267
- return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3268
- className: "ds-u-margin-bottom--1",
3269
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
3270
- link: link,
3271
- className: "dc-menu-item"
3272
- })
3273
- }, link.id);
3274
- })
3275
- })
3276
- ]
3277
- })
3278
- ]
3279
- })
3280
- })
3281
- }),
3282
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3283
- className: `dc-c-footer__cms-information ds-l-md-col--5 ds-l-sm-col--12 ${md ? "ds-u-padding-left--7" : ""} ${sm ? " ds-u-padding-left--4" : ""} ds-u-padding-y--7`,
3284
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3285
- className: "ds-u-font-size--small",
3286
- children: [
3287
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3288
- children: [
3289
- /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
3290
- href: "http://www.hhs.gov/",
3291
- target: "_blank",
3292
- title: "U.S. Department of Health & Human Services",
3293
- children: [
3294
- /*#__PURE__*/ (0, $hgUW1$jsx)("img", {
3295
- className: "dc-c-footer__logo",
3296
- src: hhsLogo,
3297
- alt: "HHS Logo"
3298
- }),
3299
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3300
- className: "ds-u-visibility--screen-reader",
3301
- children: "opens in new window"
3302
- })
3303
- ]
3304
- }),
3305
- /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
3306
- className: "ds-u-margin-left--4",
3307
- target: "_blank",
3308
- href: "http://www.cms.gov/",
3309
- title: "CMS.gov Centers for Medicare & Medicaid Services",
3310
- children: [
3311
- /*#__PURE__*/ (0, $hgUW1$jsx)("img", {
3312
- className: "dc-c-footer__logo",
3313
- src: cmsLogo,
3314
- alt: "CMS Logo"
3315
- }),
3316
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3317
- className: "ds-u-visibility--screen-reader",
3318
- children: "opens in new window"
3319
- })
3320
- ]
3321
- })
3322
- ]
3323
- }),
3324
- trademarkContent,
3325
- socialMediaLinks && /*#__PURE__*/ (0, $hgUW1$jsxs)("ul", {
3326
- className: "ds-u-display--flex",
3327
- children: [
3328
- socialMediaLinks.facebook && socialMediaLinks.facebook.url && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3329
- className: "ds-u-margin-right--1",
3330
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
3331
- href: socialMediaLinks.facebook.url,
3332
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3333
- className: "dc-c-footer--svg-icon",
3334
- children: [
3335
- /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
3336
- className: "svg-inline--fa fa-circle fa-w-16",
3337
- "aria-hidden": "true",
3338
- focusable: "false",
3339
- "data-prefix": "fas",
3340
- "data-icon": "circle",
3341
- role: "presentation",
3342
- xmlns: "http://www.w3.org/2000/svg",
3343
- viewBox: "0 0 512 512",
3344
- "data-fa-i2svg": "",
3345
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3346
- d: "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"
3347
- })
3348
- }),
3349
- /*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
3350
- title: "Facebook Icon",
3351
- className: "svg-inline--fa fa-facebook-f fa-w-10 fa-inverse",
3352
- "data-fa-transform": "shrink-3.5",
3353
- "aria-labelledby": "svg-inline--fa-title-iRCARP7h6Kp3",
3354
- "data-prefix": "fab",
3355
- "data-icon": "facebook-f",
3356
- role: "img",
3357
- xmlns: "http://www.w3.org/2000/svg",
3358
- viewBox: "0 0 320 512",
3359
- "data-fa-i2svg": "",
3360
- children: [
3361
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
3362
- id: "svg-inline--fa-title-iRCARP7h6Kp3",
3363
- children: socialMediaLinks.facebook.title ? socialMediaLinks.facebook.title : "CMS Facebook"
3364
- }),
3365
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3366
- transform: "translate(160 256)",
3367
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3368
- transform: "translate(0, 0) scale(0.78125, 0.78125) rotate(0 0 0)",
3369
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3370
- d: "M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z",
3371
- transform: "translate(-160 -256)"
3372
- })
3373
- })
3374
- })
3375
- ]
3376
- })
3377
- ]
3378
- })
3379
- })
3380
- }),
3381
- socialMediaLinks.twitter && socialMediaLinks.twitter.url && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3382
- className: "ds-u-margin-right--1",
3383
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
3384
- href: socialMediaLinks.twitter.url,
3385
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3386
- className: "dc-c-footer--svg-icon",
3387
- children: [
3388
- /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
3389
- className: "svg-inline--fa fa-circle fa-w-16",
3390
- "aria-hidden": "true",
3391
- focusable: "false",
3392
- "data-prefix": "fas",
3393
- "data-icon": "circle",
3394
- role: "presentation",
3395
- xmlns: "http://www.w3.org/2000/svg",
3396
- viewBox: "0 0 512 512",
3397
- "data-fa-i2svg": "",
3398
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3399
- d: "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"
3400
- })
3401
- }),
3402
- /*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
3403
- title: "Twitter Icon",
3404
- className: "svg-inline--fa fa-twitter fa-w-16 fa-inverse",
3405
- "data-fa-transform": "shrink-3.5",
3406
- "aria-labelledby": "svg-inline--fa-title-4z03ITiPPTVF",
3407
- "data-prefix": "fab",
3408
- "data-icon": "twitter",
3409
- role: "img",
3410
- xmlns: "http://www.w3.org/2000/svg",
3411
- viewBox: "0 0 512 512",
3412
- "data-fa-i2svg": "",
3413
- children: [
3414
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
3415
- id: "svg-inline--fa-title-4z03ITiPPTVF",
3416
- children: socialMediaLinks.twitter.title ? socialMediaLinks.twitter.title : "CMS Twitter"
3417
- }),
3418
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3419
- transform: "translate(256 256)",
3420
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3421
- transform: "translate(0, 0) scale(0.78125, 0.78125) rotate(0 0 0)",
3422
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3423
- d: "M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z",
3424
- transform: "translate(-256 -256)"
3425
- })
3426
- })
3427
- })
3428
- ]
3429
- })
3430
- ]
3431
- })
3432
- })
3433
- }),
3434
- socialMediaLinks.linkedin && socialMediaLinks.linkedin.url && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3435
- className: "ds-u-margin-right--1",
3436
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
3437
- href: socialMediaLinks.linkedin.url,
3438
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3439
- className: "dc-c-footer--svg-icon",
3440
- children: [
3441
- /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
3442
- className: "svg-inline--fa fa-circle fa-w-16",
3443
- "aria-hidden": "true",
3444
- focusable: "false",
3445
- "data-prefix": "fas",
3446
- "data-icon": "circle",
3447
- role: "presentation",
3448
- xmlns: "http://www.w3.org/2000/svg",
3449
- viewBox: "0 0 512 512",
3450
- "data-fa-i2svg": "",
3451
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3452
- d: "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"
3453
- })
3454
- }),
3455
- /*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
3456
- title: "LinkedIn Icon",
3457
- className: "svg-inline--fa fa-linkedin-in fa-w-14 fa-inverse",
3458
- "data-fa-transform": "shrink-3.5",
3459
- "aria-labelledby": "svg-inline--fa-title-Nm2qsuSKvuRZ",
3460
- "data-prefix": "fab",
3461
- "data-icon": "linkedin-in",
3462
- role: "img",
3463
- xmlns: "http://www.w3.org/2000/svg",
3464
- viewBox: "0 0 448 512",
3465
- "data-fa-i2svg": "",
3466
- children: [
3467
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
3468
- id: "svg-inline--fa-title-Nm2qsuSKvuRZ",
3469
- children: socialMediaLinks.linkedin.title ? socialMediaLinks.linkedin.title : "CMS LinkedIn"
3470
- }),
3471
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3472
- transform: "translate(224 256)",
3473
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3474
- transform: "translate(0, 0) scale(0.78125, 0.78125) rotate(0 0 0)",
3475
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3476
- d: "M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z",
3477
- transform: "translate(-224 -256)"
3478
- })
3479
- })
3480
- })
3481
- ]
3482
- })
3483
- ]
3484
- })
3485
- })
3486
- }),
3487
- socialMediaLinks.youtube && socialMediaLinks.youtube.url && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3488
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
3489
- href: socialMediaLinks.youtube.url,
3490
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3491
- className: "dc-c-footer--svg-icon",
3492
- children: [
3493
- /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
3494
- className: "svg-inline--fa fa-circle fa-w-16",
3495
- "aria-hidden": "true",
3496
- focusable: "false",
3497
- "data-prefix": "fas",
3498
- "data-icon": "circle",
3499
- role: "presentation",
3500
- xmlns: "http://www.w3.org/2000/svg",
3501
- viewBox: "0 0 512 512",
3502
- "data-fa-i2svg": "",
3503
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3504
- d: "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"
3505
- })
3506
- }),
3507
- /*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
3508
- title: "youTube Icon",
3509
- className: "svg-inline--fa fa-youtube fa-w-18 fa-inverse",
3510
- "data-fa-transform": "shrink-3.5",
3511
- "aria-labelledby": "svg-inline--fa-title-youtube",
3512
- "data-prefix": "fab",
3513
- "data-icon": "youtube",
3514
- role: "img",
3515
- xmlns: "http://www.w3.org/2000/svg",
3516
- viewBox: "0 0 576 512",
3517
- "data-fa-i2svg": "",
3518
- children: [
3519
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
3520
- id: "svg-inline--fa-title-youtube",
3521
- children: socialMediaLinks.youtube.title ? socialMediaLinks.youtube.title : "CMS youtube"
3522
- }),
3523
- /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3524
- fill: "currentColor",
3525
- d: "M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"
3526
- })
3527
- ]
3528
- })
3529
- ]
3530
- })
3531
- })
3532
- })
3533
- ]
3534
- })
3535
- ]
3536
- })
3537
- })
3538
- ]
3539
- })
3540
- })
3541
- }),
3542
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3543
- className: "dc-c-footer__utility ds-l-container ds-u-padding-y--2 ds-u-font-size--small",
3544
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3545
- className: "ds-l-row ",
3546
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3547
- className: "ds-l-col--12 ds-u-padding-y--3",
3548
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
3549
- className: `ds-u-padding--0 ds-u-display--flex ${md ? "ds-u-flex-direction--row" : "ds-u-flex-direction--column"} ds-u-flex-wrap--wrap`,
3550
- children: footerUtilityLinks.map((link)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
3551
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
3552
- href: link.url,
3553
- className: "ds-u-margin-right--2",
3554
- children: link.label
3555
- })
3556
- }, link.id))
3557
- })
3558
- })
3559
- })
3560
- })
3561
- ]
3562
- });
3563
- };
3564
- $a6df0aa147323304$var$Footer.defaultProps = {
3565
- showEmail: true,
3566
- emailTitle: "Get Email Updates",
3567
- emailBody: "Sign up to get the latest information from CMS by choosing the topics and frequency of emails that are best for you.",
3568
- emailLink: "",
3569
- emailButton: "Sign up for email updates",
3570
- socialMediaLinks: null,
3571
- trademarkContent: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3572
- children: [
3573
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3574
- children: "A federal government website managed and paid for by the U.S. Centers for Medicare & Medicaid Services."
3575
- }),
3576
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3577
- children: "7500 Security Boulevard, Baltimore, MD 21244"
3578
- })
3579
- ]
3580
- })
3581
- };
3582
- $a6df0aa147323304$var$Footer.propTypes = {
3583
- showEmail: (0, $hgUW1$proptypes).bool,
3584
- emailTitle: (0, $hgUW1$proptypes).string,
3585
- emailBody: (0, $hgUW1$proptypes).string,
3586
- emailLink: (0, $hgUW1$proptypes).string,
3587
- emailButton: (0, $hgUW1$proptypes).string,
3588
- links: (0, $hgUW1$proptypes).shape({
3589
- footerOpenDataToolLinks: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
3590
- id: (0, $hgUW1$proptypes).string,
3591
- label: (0, $hgUW1$proptypes).string,
3592
- url: (0, $hgUW1$proptypes).string,
3593
- target: (0, $hgUW1$proptypes).string
3594
- })),
3595
- footerAdditionalResourcesLinks: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
3596
- id: (0, $hgUW1$proptypes).string,
3597
- label: (0, $hgUW1$proptypes).string,
3598
- url: (0, $hgUW1$proptypes).string,
3599
- target: (0, $hgUW1$proptypes).string
3600
- })),
3601
- footerUtilityLinks: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
3602
- id: (0, $hgUW1$proptypes).string,
3603
- label: (0, $hgUW1$proptypes).string,
3604
- url: (0, $hgUW1$proptypes).string,
3605
- target: (0, $hgUW1$proptypes).string
3606
- }))
3607
- }).isRequired,
3608
- socialMediaLinks: (0, $hgUW1$proptypes).shape({
3609
- facebook: (0, $hgUW1$proptypes).shape({
3610
- title: (0, $hgUW1$proptypes).string,
3611
- url: (0, $hgUW1$proptypes).string
3612
- }),
3613
- twitter: (0, $hgUW1$proptypes).shape({
3614
- title: (0, $hgUW1$proptypes).string,
3615
- url: (0, $hgUW1$proptypes).string
3616
- }),
3617
- linkedin: (0, $hgUW1$proptypes).shape({
3618
- title: (0, $hgUW1$proptypes).string,
3619
- url: (0, $hgUW1$proptypes).string
3620
- })
3621
- }),
3622
- hhsLogo: (0, $hgUW1$proptypes).string.isRequired,
3623
- cmsLogo: (0, $hgUW1$proptypes).string.isRequired
3624
- };
3625
- var $a6df0aa147323304$export$2e2bcd8739ae039 = $a6df0aa147323304$var$Footer;
3626
-
3627
-
3628
-
3629
-
3630
- const $efc410f5f7ac5ef3$var$useSearchAPI = (rootUrl, initialSearchParams = {}, additionalParams = {})=>{
3631
- const defaultSort = "";
3632
- const defaultFulltext = "";
3633
- const defaultSelectedFacets = {};
3634
- const defaultSortOrder = "";
3635
- const defaultPage = 1;
3636
- const defaultPageSize = 10;
3637
- const sortOptions = [
3638
- "modified",
3639
- "title"
3640
- ];
3641
- const sortOrderOptions = [
3642
- "asc",
3643
- "desc"
3644
- ];
3645
- const [items, setItems] = (0, $hgUW1$useState)([]);
3646
- const [facets, setFacets] = (0, $hgUW1$useState)([]);
3647
- const [loading, setLoading] = (0, $hgUW1$useState)(false);
3648
- const [totalItems, setTotalItems] = (0, $hgUW1$useState)(null);
3649
- const [selectedFacets, setSelectedFacets] = (0, $hgUW1$useState)(initialSearchParams.selectedFacets ? initialSearchParams.selectedFacets : defaultSelectedFacets);
3650
- const [fulltext, setFulltext] = (0, $hgUW1$useState)(initialSearchParams.fulltext ? initialSearchParams.fulltext : defaultFulltext);
3651
- const [sort, setSort] = (0, $hgUW1$useState)(initialSearchParams.sort ? initialSearchParams.sort : defaultSort);
3652
- const [sortOrder, setSortOrder] = (0, $hgUW1$useState)(initialSearchParams.sortOrder ? initialSearchParams.sortOrder : defaultSortOrder);
3653
- const [page, setPage] = (0, $hgUW1$useState)(initialSearchParams.page ? initialSearchParams.page : defaultPage);
3654
- const [pageSize, setPageSize] = (0, $hgUW1$useState)(initialSearchParams.pageSize ? initialSearchParams.pageSize : defaultPageSize);
3655
- async function search() {
3656
- const options = {
3657
- fulltext: fulltext,
3658
- selectedFacets: selectedFacets,
3659
- sort: sort,
3660
- sortOrder: sortOrder,
3661
- page: Number(page),
3662
- pageSize: pageSize
3663
- };
3664
- const results = await (0, $116bd29db288848e$export$2d2256cb46e92ff7)(rootUrl, options, additionalParams);
3665
- const itemKeys = Object.keys(results.data.results);
3666
- const itemsArray = itemKeys.map((key)=>{
3667
- return results.data.results[key];
3668
- });
3669
- setFacets(results.data.facets);
3670
- setItems(itemsArray);
3671
- setTotalItems(results.data.total);
3672
- setLoading(false);
3673
- }
3674
- function resetFilters() {
3675
- setFulltext(defaultFulltext);
3676
- setSelectedFacets(defaultSelectedFacets);
3677
- setPage(defaultPage);
3678
- }
3679
- function updateSelectedFacets(currentFacet) {
3680
- const facets = (0, $116bd29db288848e$export$9ef1e909a5e43470)(currentFacet, selectedFacets);
3681
- setSelectedFacets(facets);
3682
- }
3683
- (0, $hgUW1$useEffect)(()=>{
3684
- if (totalItems !== null) setPage(1);
3685
- }, [
3686
- fulltext,
3687
- selectedFacets,
3688
- pageSize
3689
- ]);
3690
- (0, $hgUW1$useEffect)(()=>{
3691
- const timer = setTimeout(()=>{
3692
- setLoading(true);
3693
- search();
3694
- }, 1000);
3695
- return ()=>clearTimeout(timer);
3696
- }, [
3697
- fulltext,
3698
- selectedFacets,
3699
- sort,
3700
- sortOrder,
3701
- page,
3702
- pageSize
3703
- ]);
3704
- return {
3705
- fulltext: fulltext,
3706
- selectedFacets: selectedFacets,
3707
- sortOptions: sortOptions,
3708
- sortOrderOptions: sortOrderOptions,
3709
- items: items,
3710
- facets: facets,
3711
- loading: loading,
3712
- totalItems: totalItems,
3713
- sort: sort,
3714
- sortOrder: sortOrder,
3715
- page: page,
3716
- pageSize: pageSize,
3717
- setPage: setPage,
3718
- setPageSize: setPageSize,
3719
- setSort: setSort,
3720
- setSortOrder: setSortOrder,
3721
- updateSelectedFacets: updateSelectedFacets,
3722
- setFulltext: setFulltext,
3723
- resetFilters: resetFilters
3724
- };
3725
- };
3726
- var $efc410f5f7ac5ef3$export$2e2bcd8739ae039 = $efc410f5f7ac5ef3$var$useSearchAPI;
3727
-
3728
-
3729
-
3730
-
3731
-
3732
-
3733
-
3734
-
3735
-
3736
- const $59a079354baa335c$var$Hero = ({ title: title , description: description , searchUrl: searchUrl , searchKey: searchKey , textfieldLabel: textfieldLabel , searchButtonText: searchButtonText })=>{
3737
- const navigate = (0, $hgUW1$useNavigate)();
3738
- const [searchValue, setSearchValue] = (0, $hgUW1$react).useState("");
3739
- function submitHero(e) {
3740
- e.preventDefault();
3741
- navigate(`/${searchUrl}?${searchKey}=${searchValue}`);
3742
- }
3743
- return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
3744
- className: `dc-c-hero ds-base ds-u-padding--2`,
3745
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3746
- className: "ds-l-container",
3747
- children: [
3748
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3749
- className: "ds-l-row",
3750
- children: [
3751
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
3752
- className: "ds-text-heading--5xl ds-u-color--white ds-u-margin-y--1",
3753
- children: title
3754
- }),
3755
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3756
- className: "ds-u-color--white ds-u-measure--wide",
3757
- children: description
3758
- })
3759
- ]
3760
- }),
3761
- /*#__PURE__*/ (0, $hgUW1$jsx)("form", {
3762
- onSubmit: (e)=>submitHero(e),
3763
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3764
- style: {
3765
- position: "relative"
3766
- },
3767
- className: "ds-l-row ds-u-align-items--stretch ds-u-margin-y--4 ds-u-flex-wrap--nowrap",
3768
- children: [
3769
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3770
- className: "ds-u-padding--0 ds-u-margin-right--1",
3771
- style: {
3772
- flex: "1 1 100%",
3773
- maxWidth: "100%"
3774
- },
3775
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
3776
- label: textfieldLabel,
3777
- labelClassName: "ds-u-visibility--screen-reader",
3778
- name: "search_text_input",
3779
- style: {
3780
- maxWidth: "none",
3781
- height: "61px",
3782
- margin: "0 20px 0 0"
3783
- },
3784
- onChange: (e)=>setSearchValue(e.target.value)
3785
- })
3786
- }),
3787
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
3788
- className: "ds-u-margin-left--auto",
3789
- size: "big",
3790
- type: "submit",
3791
- variation: "solid",
3792
- onDark: true,
3793
- children: [
3794
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3795
- className: "fas fa-search small-text ds-u-sm-display--none"
3796
- }),
3797
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3798
- className: "full-text ds-u-display--none ds-u-sm-display--inline-block",
3799
- children: searchButtonText
3800
- })
3801
- ]
3802
- })
3803
- ]
3804
- })
3805
- })
3806
- ]
3807
- })
3808
- });
3809
- };
3810
- $59a079354baa335c$var$Hero.defaultProps = {
3811
- searchKey: "fulltext",
3812
- searchUrl: "datasets",
3813
- textfieldLabel: "Search for a dataset",
3814
- searchButtonText: "Search"
3815
- };
3816
- var $59a079354baa335c$export$2e2bcd8739ae039 = $59a079354baa335c$var$Hero;
3817
-
3818
-
3819
-
3820
-
3821
-
3822
-
3823
-
3824
-
3825
-
3826
-
3827
-
3828
-
3829
-
3830
- const $847b0964185837b2$var$CloseIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
3831
- width: "15px",
3832
- height: "15px",
3833
- viewBox: "0 0 15 15",
3834
- version: "1.1",
3835
- xmlns: "http://www.w3.org/2000/svg",
3836
- xmlnsXlink: "http://www.w3.org/1999/xlink",
3837
- children: [
3838
- /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
3839
- children: "Close Icon"
3840
- }),
3841
- /*#__PURE__*/ (0, $hgUW1$jsx)("desc", {
3842
- children: "Created with Sketch."
3843
- }),
3844
- /*#__PURE__*/ (0, $hgUW1$jsx)("g", {
3845
- stroke: "none",
3846
- strokeWidth: "1",
3847
- fill: "none",
3848
- fillRule: "evenodd",
3849
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3850
- 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",
3851
- fill: "#000000",
3852
- fillRule: "nonzero"
3853
- })
3854
- })
3855
- ]
3856
- });
3857
- var $847b0964185837b2$export$2e2bcd8739ae039 = $847b0964185837b2$var$CloseIcon;
3858
-
3859
-
3860
-
3861
- function $3535053b28e5ffce$var$convertUTCToLocalDate(date) {
3862
- if (!date) return date;
3863
- date = new Date(date);
3864
- date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
3865
- return date;
3866
- }
3867
- function $3535053b28e5ffce$var$buildOperatorOptions(type) {
3868
- switch(type){
3869
- case "text":
3870
- case "string":
3871
- return [
3872
- {
3873
- label: "Is",
3874
- value: "="
3875
- },
3876
- {
3877
- label: "Contains",
3878
- value: "like"
3879
- },
3880
- {
3881
- label: "Is Not",
3882
- value: "<>"
3883
- },
3884
- {
3885
- label: "Or",
3886
- value: "in"
3887
- }
3888
- ];
3889
- case "date":
3890
- return [
3891
- {
3892
- label: "Is",
3893
- value: "="
3894
- },
3895
- {
3896
- label: "Is Not",
3897
- value: "<>"
3898
- },
3899
- {
3900
- label: "Greater Than",
3901
- value: ">"
3902
- },
3903
- {
3904
- label: "Less Than",
3905
- value: "<"
3906
- }
3907
- ];
3908
- default:
3909
- // These 2 should be safe for all data types
3910
- return [
3911
- {
3912
- label: "Is",
3913
- value: "="
3914
- },
3915
- {
3916
- label: "Is Not",
3917
- value: "<>"
3918
- }
3919
- ];
3920
- }
3921
- }
3922
- function $3535053b28e5ffce$var$cleanText(value, operator) {
3923
- let newValue = value;
3924
- if (Array.isArray(newValue)) newValue = newValue.join(",");
3925
- return newValue.replace(/(^\%+|\%+$)/gm, "");
3926
- }
3927
- const $3535053b28e5ffce$var$ResourceConditionField = ({ data: data , index: index , remove: remove , schema: schema , update: update })=>{
3928
- const { fields: fields } = schema;
3929
- const [startDate, setStartDate] = (0, $hgUW1$react).useState(data.value ? new Date(data.value) : new Date());
3930
- const [propertyOptions, setPropertyOptions] = (0, $hgUW1$react).useState(Object.keys(fields).map((key)=>{
3931
- return {
3932
- label: fields[key].description ? fields[key].description : key,
3933
- value: key
3934
- };
3935
- }));
3936
- const [property, setProperty] = (0, $hgUW1$react).useState(data.property);
3937
- const [operator, setOperator] = (0, $hgUW1$react).useState(data.operator);
3938
- const [operatorOptions, setOperatorOptions] = (0, $hgUW1$react).useState([
3939
- {
3940
- label: "--",
3941
- value: ""
3942
- }
3943
- ]);
3944
- const [value, setValue] = (0, $hgUW1$react).useState(data.value);
3945
- (0, $hgUW1$react).useEffect(()=>{
3946
- if (property) {
3947
- const opOptions = $3535053b28e5ffce$var$buildOperatorOptions(fields[property].mysql_type ? fields[property].mysql_type : fields[property].type).map((opt)=>{
3948
- return {
3949
- label: opt.label,
3950
- value: opt.value
3951
- };
3952
- });
3953
- update(index, "property", property);
3954
- if (!operator) setOperator(opOptions[0].value);
3955
- setOperatorOptions(opOptions);
3956
- if (fields[property].mysql_type && fields[property].mysql_type === "date" || fields[property].type === "date") setValue(startDate.toJSON().slice(0, 10));
3957
- } else {
3958
- update(index, "property", property);
3959
- setOperator("");
3960
- setValue("");
3961
- setOperatorOptions([
3962
- {
3963
- label: "--",
3964
- value: ""
3965
- }
3966
- ]);
3967
- }
3968
- }, [
3969
- property,
3970
- operator
3971
- ]);
3972
- (0, $hgUW1$react).useEffect(()=>{
3973
- if (operator) update(index, "operator", operator);
3974
- else update(index, "operator", "");
3975
- }, [
3976
- operator
3977
- ]);
3978
- (0, $hgUW1$react).useEffect(()=>{
3979
- if (value) update(index, "value", value);
3980
- else update(index, "value", "");
3981
- }, [
3982
- value
3983
- ]);
3984
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
3985
- children: [
3986
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3987
- className: "ds-l-form-row",
3988
- children: [
3989
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3990
- options: [
3991
- {
3992
- label: "Select column",
3993
- value: ""
3994
- },
3995
- ...propertyOptions
3996
- ],
3997
- value: property,
3998
- onChange: (e)=>setProperty(e.target.value),
3999
- label: "Filter column",
4000
- labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
4001
- name: `column_name_${index}`,
4002
- className: "ds-l-col--6"
4003
- }),
4004
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4005
- options: [
4006
- ...operatorOptions
4007
- ],
4008
- value: operator,
4009
- disabled: !property ? true : false,
4010
- onChange: (e)=>setOperator(e.target.value),
4011
- labelClassName: "ds-u-margin-top--0 ds-u-visibility--screen-reader",
4012
- size: "small",
4013
- label: "Filter operator",
4014
- name: `filter_operator_${index}`,
4015
- className: "ds-l-col--3"
4016
- })
4017
- ]
4018
- }),
4019
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4020
- className: "ds-l-form-row",
4021
- children: [
4022
- property && (fields[property].mysql_type === "date" || fields[property].type === "date") ? /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4023
- className: "ds-u-clearfix ds-l-col--11",
4024
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
4025
- selected: $3535053b28e5ffce$var$convertUTCToLocalDate(startDate),
4026
- onChange: (date)=>{
4027
- setStartDate(date);
4028
- setValue(date.toJSON().slice(0, 10));
4029
- },
4030
- showMonthDropdown: true,
4031
- showYearDropdown: true,
4032
- dropdownMode: "select",
4033
- className: "ds-c-field"
4034
- })
4035
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
4036
- hint: operator.toLowerCase() === "in" ? `Separate values with a comma.` : "",
4037
- value: $3535053b28e5ffce$var$cleanText(value, operator),
4038
- disabled: !property ? true : false,
4039
- onChange: (e)=>setValue(e.target.value),
4040
- label: "Filter value",
4041
- labelClassName: "ds-u-margin-top--0",
4042
- name: `filter_value_${index}`,
4043
- className: "ds-l-col--11"
4044
- }),
4045
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4046
- className: "ds-l-col--1",
4047
- variation: "transparent",
4048
- "aria-label": "Remove filter",
4049
- onClick: (e)=>{
4050
- e.preventDefault();
4051
- remove(index);
4052
- },
4053
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $847b0964185837b2$export$2e2bcd8739ae039), {})
4054
- })
4055
- ]
4056
- })
4057
- ]
4058
- });
4059
- };
4060
- var $3535053b28e5ffce$export$2e2bcd8739ae039 = $3535053b28e5ffce$var$ResourceConditionField;
4061
-
4062
-
4063
- const $f29607dfa784d2bd$var$ResourceFilter = ({ id: id , filterOpen: filterOpen , setFilterOpen: setFilterOpen , defaultCondition: defaultCondition , resource: resource , includeSearchParams: includeSearchParams })=>{
4064
- const { setConditions: setConditions , schema: schema , conditions: conditions } = resource;
4065
- const [formConditions, setFormConditions] = (0, $hgUW1$react).useState(conditions && conditions.length ? conditions : [
4066
- {
4067
- ...defaultCondition
4068
- }
4069
- ]);
4070
- (0, $hgUW1$react).useEffect(()=>{
4071
- if (includeSearchParams) {
4072
- const url = new URL(window.location);
4073
- const urlString = (0, $hgUW1$qs).stringify({
4074
- conditions: conditions
4075
- }, {
4076
- encodeValuesOnly: true,
4077
- addQueryPrefix: true
4078
- });
4079
- window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
4080
- }
4081
- }, [
4082
- conditions
4083
- ]);
4084
- function removeByIndex(index) {
4085
- let newConditions = [
4086
- ...formConditions
4087
- ];
4088
- newConditions.splice(index, 1);
4089
- setFormConditions(newConditions);
4090
- setConditions(newConditions);
4091
- }
4092
- function updateByIndex(index, key, value) {
4093
- let newConditions = [
4094
- ...formConditions
4095
- ];
4096
- newConditions[index][key] = value;
4097
- setFormConditions(newConditions);
4098
- }
4099
- function removeAll() {
4100
- setFormConditions([]);
4101
- setConditions([]);
4102
- }
4103
- function submitFilters(e) {
4104
- e.preventDefault();
4105
- if (formConditions.length) {
4106
- const updatedConditions = formConditions.filter((cond)=>{
4107
- if (cond.property) return cond;
4108
- return false;
4109
- }).map((cond)=>{
4110
- if (cond.operator === "=" || cond.operator === "<>") {
4111
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4112
- cond.value = cond.value.replace(/(^\%+|\%+$)/gm, "");
4113
- }
4114
- if (cond.operator.toLowerCase() === "like") {
4115
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4116
- const cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, "");
4117
- cond.value = `%${cleanedValue}%`;
4118
- }
4119
- if (cond.operator.toLowerCase() === "in") {
4120
- if (!Array.isArray(cond.value)) cond.value = cond.value.split(",");
4121
- }
4122
- if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
4123
- return cond;
4124
- });
4125
- setConditions(updatedConditions);
4126
- }
4127
- }
4128
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$HelpDrawer), {
4129
- footerTitle: "Update actions",
4130
- footerBody: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4131
- className: "ds-u-margin-right--1",
4132
- onClick: (e)=>submitFilters(e, formConditions),
4133
- children: "Update table"
4134
- }),
4135
- heading: "Add filters",
4136
- className: "dc-c-filterd-resouce-drawer",
4137
- onCloseClick: ()=>{
4138
- setFilterOpen(!filterOpen);
4139
- },
4140
- children: [
4141
- /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
4142
- onSubmit: (e)=>submitFilters(e, formConditions),
4143
- children: [
4144
- Object.keys(schema).length && formConditions.map((f, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $3535053b28e5ffce$export$2e2bcd8739ae039), {
4145
- data: f,
4146
- index: index,
4147
- remove: removeByIndex,
4148
- schema: schema[id],
4149
- update: updateByIndex
4150
- }, index)),
4151
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4152
- className: "ds-u-margin-right--1",
4153
- variation: "ghost",
4154
- onClick: (e)=>{
4155
- e.preventDefault();
4156
- setFormConditions([
4157
- ...formConditions,
4158
- {
4159
- ...defaultCondition
4160
- }
4161
- ]);
4162
- },
4163
- children: "+ Add another filter"
4164
- })
4165
- ]
4166
- }),
4167
- formConditions.length > 1 ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4168
- variation: "ghost",
4169
- onClick: (e)=>{
4170
- e.preventDefault();
4171
- removeAll();
4172
- },
4173
- children: "Remove all filters"
4174
- }) : ""
4175
- ]
4176
- });
4177
- };
4178
- $f29607dfa784d2bd$var$ResourceFilter.defaultProps = {
4179
- defaultCondition: {
4180
- property: "",
4181
- value: "",
4182
- operator: ""
4183
- },
4184
- includeSearchParams: true
4185
- };
4186
- var $f29607dfa784d2bd$export$2e2bcd8739ae039 = $f29607dfa784d2bd$var$ResourceFilter;
4187
-
4188
-
4189
-
4190
-
4191
-
4192
-
4193
-
4194
-
4195
-
4196
-
4197
- const $ec3e23baa005dc03$var$Breadcrumb = ({ currentPage: currentPage , pageTrail: pageTrail = [] })=>{
4198
- const pageTrailContent = pageTrail.map((page)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
4199
- class: "dc-c-breadcrumb__list-item",
4200
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
4201
- to: page.path,
4202
- class: "dc-c-breadcrumb__link",
4203
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4204
- children: page.title
4205
- })
4206
- })
4207
- }));
4208
- return /*#__PURE__*/ (0, $hgUW1$jsx)("nav", {
4209
- class: "dc-c-breadcrumb ds-u-margin-top--6",
4210
- "aria-label": "Breadcrumbs",
4211
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
4212
- class: "dc-c-breadcrumb__list",
4213
- children: [
4214
- pageTrailContent,
4215
- currentPage ? /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
4216
- class: "dc-c-breadcrumb__list-item dc-c-current",
4217
- "aria-current": "page",
4218
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4219
- children: currentPage
4220
- })
4221
- }) : ""
4222
- ]
4223
- })
4224
- });
4225
- };
4226
- $ec3e23baa005dc03$var$Breadcrumb.propTypes = {
4227
- currentPage: (0, $hgUW1$proptypes).string.isRequired,
4228
- pageTrail: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
4229
- path: (0, $hgUW1$proptypes).string.isRequired,
4230
- title: (0, $hgUW1$proptypes).string.isRequired
4231
- }))
4232
- };
4233
- var $ec3e23baa005dc03$export$2e2bcd8739ae039 = $ec3e23baa005dc03$var$Breadcrumb;
4234
-
4235
-
4236
-
4237
-
4238
-
4239
-
4240
-
4241
-
4242
-
4243
-
4244
-
4245
-
4246
-
4247
-
4248
-
4249
-
4250
-
4251
-
4252
-
4253
-
4254
-
4255
-
4256
-
4257
-
4258
-
4259
-
4260
-
4261
-
4262
-
4263
-
4264
-
4265
-
4266
-
4267
- function $374c4669b044ddf8$var$getStartDate(condition, schema, id) {
4268
- if (schema[id].fields[condition.property].mysql_type === "date") {
4269
- const newDate = new Date(condition.value);
4270
- if (newDate instanceof Date && !isNaN(newDate)) return newDate;
4271
- }
4272
- return new Date();
4273
- }
4274
- const $374c4669b044ddf8$var$QueryRow = ({ id: id , condition: condition , index: index , update: update , remove: remove , propertyOptions: propertyOptions , schema: schema })=>{
4275
- const md = (0, $hgUW1$useMediaQuery)({
4276
- minWidth: 0,
4277
- maxWidth: 768
4278
- });
4279
- const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
4280
- const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
4281
- const [value, setValue] = (0, $hgUW1$useState)(condition.value);
4282
- const [startDate, setStartDate] = (0, $hgUW1$react).useState($374c4669b044ddf8$var$getStartDate(condition, schema, id));
4283
- (0, $hgUW1$useEffect)(()=>{
4284
- if (property !== condition.property) {
4285
- if (property) update(index, "property", property);
4286
- else update(index, "property", "");
4287
- if (schema[id].fields[condition.property].mysql_type === "date") {
4288
- if (!value) setValue(startDate.toJSON().slice(0, 10));
4289
- }
4290
- }
4291
- }, [
4292
- property,
4293
- value,
4294
- startDate,
4295
- schema,
4296
- id,
4297
- condition
4298
- ]);
4299
- (0, $hgUW1$useEffect)(()=>{
4300
- if (operator !== condition.operator) {
4301
- if (operator) update(index, "operator", operator);
4302
- else update(index, "operator", "");
4303
- }
4304
- }, [
4305
- operator
4306
- ]);
4307
- (0, $hgUW1$useEffect)(()=>{
4308
- if (value !== condition.value) {
4309
- if (value) update(index, "value", value);
4310
- else update(index, "value", "");
4311
- }
4312
- }, [
4313
- value
4314
- ]);
4315
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
4316
- className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center",
4317
- children: [
4318
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4319
- options: propertyOptions,
4320
- value: property,
4321
- label: "Property",
4322
- name: `${condition.key}_property`,
4323
- onChange: (e)=>setProperty(e.target.value)
4324
- }),
4325
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
4326
- options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
4327
- value: operator,
4328
- size: "small",
4329
- label: "Operator",
4330
- name: `${condition.key}_operator`,
4331
- onChange: (e)=>setOperator(e.target.value)
4332
- }),
4333
- schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4334
- children: [
4335
- /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
4336
- className: "ds-c-label",
4337
- htmlFor: `${condition.key}_date_value`,
4338
- id: `${condition.key}_date_value-label`,
4339
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4340
- children: "Value"
4341
- })
4342
- }),
4343
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
4344
- name: `${condition.key}_date_value`,
4345
- selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
4346
- onChange: (date)=>{
4347
- setStartDate(date);
4348
- setValue(date.toJSON().slice(0, 10));
4349
- },
4350
- showMonthDropdown: true,
4351
- showYearDropdown: true,
4352
- dropdownMode: "select",
4353
- className: "ds-c-field",
4354
- withPortal: true
4355
- })
4356
- ]
4357
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
4358
- label: "Value",
4359
- name: `${condition.key}_value`,
4360
- value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
4361
- onChange: (e)=>setValue(e.target.value)
4362
- }),
4363
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4364
- variation: md ? "transparent" : null,
4365
- size: "small",
4366
- className: "ds-u-margin-top--3",
4367
- "aria-label": "Delete filter",
4368
- onClick: ()=>remove(index),
4369
- children: !md ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
4370
- children: "Delete filter"
4371
- }) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
4372
- children: [
4373
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $847b0964185837b2$export$2e2bcd8739ae039), {}),
4374
- " "
4375
- ]
4376
- })
4377
- })
4378
- ]
4379
- });
4380
- };
4381
- var $374c4669b044ddf8$export$2e2bcd8739ae039 = $374c4669b044ddf8$var$QueryRow;
4382
-
4383
-
4384
-
4385
-
4386
-
4387
-
4388
- const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions , schema: schema , customColumns: customColumns })=>{
4389
- const { fields: fields } = schema;
4390
- if (!conditions.length) return "Add a filter";
4391
- function formatValue(text, property) {
4392
- if (customColumns.length > 0) {
4393
- let newValue = text;
4394
- let customColumn = customColumns.find((c)=>c.accessor === property);
4395
- if (customColumn && customColumn.Cell) return customColumn.Cell({
4396
- value: text
4397
- });
4398
- return text;
4399
- } else return text;
4400
- }
4401
- function buildTitle() {
4402
- const newTitle = conditions.map((c)=>{
4403
- const field = fields[c.property];
4404
- const description = field && field.description ? field.description : c.property;
4405
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
4406
- return `${description} ${operator.label} ${(0, $7264a673914aa746$export$6b5e57d20078142b)(c.value)}`;
4407
- });
4408
- return newTitle.join(" AND ");
4409
- }
4410
- return /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4411
- className: "dc-querybuilder-title",
4412
- children: conditions.map((c)=>{
4413
- const field = fields[c.property];
4414
- const description = field && field.description ? field.description : c.property;
4415
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
4416
- const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
4417
- const formattedText = formatValue(cleanedText, c.property);
4418
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
4419
- className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
4420
- children: [
4421
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4422
- className: "ds-u-font-weight--bold",
4423
- children: description
4424
- }),
4425
- " ",
4426
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4427
- className: "ds-u-font-weight--normal",
4428
- children: operator.label.toUpperCase()
4429
- }),
4430
- " ",
4431
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4432
- className: "ds-u-color--success",
4433
- children: formattedText
4434
- })
4435
- ]
4436
- });
4437
- }).reduce((prev, curr)=>[
4438
- prev,
4439
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
4440
- className: "ds-u-margin-x--1",
4441
- variation: "info",
4442
- children: "AND"
4443
- }),
4444
- curr
4445
- ])
4446
- });
4447
- };
4448
- var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
4449
-
4450
-
4451
-
4452
- function $3b6ca952e79f0695$var$updateQueryForDatastore(condition) {
4453
- let cond = condition;
4454
- delete cond.key;
4455
- if (cond.operator === "=" || cond.operator === "<>") {
4456
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4457
- cond.value = cond.value.replace(/(^\%+|\%+$)/gm, "");
4458
- }
4459
- if (cond.operator.toLowerCase() === "like") {
4460
- if (Array.isArray(cond.value)) cond.value = cond.value.join();
4461
- const cleanedValue = cond.value.replace(/(^\%+|\%+$)/gm, "");
4462
- cond.value = `%${cleanedValue}%`;
4463
- }
4464
- if (cond.operator.toLowerCase() === "in") {
4465
- if (!Array.isArray(cond.value)) cond.value = cond.value.split(",");
4466
- }
4467
- if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
4468
- return cond;
4469
- }
4470
- const $3b6ca952e79f0695$var$QueryBuilder = ({ resource: resource , id: id , includeSearchParams: includeSearchParams , customColumns: customColumns })=>{
4471
- const { conditions: conditions , schema: schema , setConditions: setConditions } = resource;
4472
- const fields = Object.keys(schema[id].fields);
4473
- const hasConditions = conditions.length > 0;
4474
- const [queryCount, setQueryCount] = (0, $hgUW1$useState)(0);
4475
- const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
4476
- const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]); // Add use effect to load conditions on first load if needed
4477
- const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);
4478
- const addCondition = (condition)=>{
4479
- if (Array.isArray(condition)) {
4480
- const keyedConditions = condition.map((oc)=>({
4481
- ...oc,
4482
- key: Date.now() + oc.value + oc.property
4483
- }));
4484
- setQueryConditions(keyedConditions);
4485
- } else setQueryConditions([
4486
- ...queryConditions,
4487
- {
4488
- property: fields[0],
4489
- value: "",
4490
- operator: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[fields[0]].mysql_type)[0].value,
4491
- key: Date.now()
4492
- }
4493
- ]);
4494
- };
4495
- (0, $hgUW1$react).useEffect(()=>{
4496
- addCondition(conditions);
4497
- setTitleConditions(conditions);
4498
- }, []);
4499
- const propertyOptions = fields.map((f)=>{
4500
- if (schema[id].fields[f].description) return {
4501
- label: schema[id].fields[f].description,
4502
- value: f
4503
- };
4504
- return {
4505
- label: f,
4506
- value: f
4507
- };
4508
- });
4509
- const submitConditions = (e)=>{
4510
- e.preventDefault();
4511
- const submitConditions = queryConditions.filter((oc)=>{
4512
- if (oc.property) return oc;
4513
- return false;
4514
- }).map((oc)=>{
4515
- let cond = Object.assign({}, oc);
4516
- return $3b6ca952e79f0695$var$updateQueryForDatastore(cond);
4517
- });
4518
- setConditions(submitConditions);
4519
- setTitleConditions(queryConditions.map((oc)=>Object.assign({}, oc)));
4520
- setConditionsChanged(false);
4521
- if (includeSearchParams) {
4522
- const url = new URL(window.location);
4523
- const urlString = (0, $hgUW1$qs).stringify({
4524
- conditions: submitConditions
4525
- }, {
4526
- encodeValuesOnly: true,
4527
- addQueryPrefix: true
4528
- });
4529
- window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
4530
- }
4531
- };
4532
- const updateCondition = (index, key, value)=>{
4533
- let newConditions = [
4534
- ...queryConditions
4535
- ];
4536
- newConditions[index][key] = value;
4537
- setQueryConditions(newConditions);
4538
- setConditionsChanged(true);
4539
- };
4540
- const removeCondition = (index)=>{
4541
- let newConditions = queryConditions.map((oc)=>Object.assign({}, oc));
4542
- newConditions.splice(index, 1);
4543
- setQueryConditions(newConditions);
4544
- setConditionsChanged(true);
4545
- };
4546
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4547
- className: "dc-query-builder ds-u-margin-bottom--3",
4548
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
4549
- bordered: true,
4550
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
4551
- heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
4552
- schema: schema[id],
4553
- conditions: titleConditions,
4554
- customColumns: customColumns
4555
- }),
4556
- defaultOpen: false,
4557
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
4558
- onSubmit: (e)=>submitConditions(e),
4559
- children: [
4560
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4561
- children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $374c4669b044ddf8$export$2e2bcd8739ae039), {
4562
- id: id,
4563
- schema: schema,
4564
- condition: qf,
4565
- index: index,
4566
- propertyOptions: propertyOptions,
4567
- update: updateCondition,
4568
- remove: removeCondition
4569
- }, qf.key))
4570
- }),
4571
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4572
- className: "dc-query-bulder--form-buttons ds-u-padding-y--2",
4573
- children: [
4574
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4575
- variation: "transparent",
4576
- onClick: ()=>addCondition(null),
4577
- children: "+ Add filter"
4578
- }),
4579
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
4580
- disabled: !conditionsChanged,
4581
- className: "ds-u-float--right",
4582
- type: "submit",
4583
- children: "Apply filters"
4584
- })
4585
- ]
4586
- })
4587
- ]
4588
- })
4589
- })
4590
- })
4591
- });
4592
- };
4593
- $3b6ca952e79f0695$var$QueryBuilder.defaultProps = {
4594
- includeSearchParams: true
4595
- };
4596
- var $3b6ca952e79f0695$export$2e2bcd8739ae039 = $3b6ca952e79f0695$var$QueryBuilder;
4597
-
4598
-
4599
-
4600
- const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id , dataset: dataset , distIndex: distIndex , location: location , apiDocPage: apiDocPage , additionalParams: additionalParams , customColumns: customColumns , columnSettings: columnSettings , columnWidths: columnWidths , customTitle: customTitle , rootUrl: rootUrl })=>{
4601
- const navigate = (0, $hgUW1$useNavigate)();
4602
- const [tablePadding, setTablePadding] = (0, $hgUW1$react).useState("ds-u-padding-y--1");
4603
- let apiDocs = (0, $hgUW1$useRef)();
4604
- const [filtersOpen, setFiltersOpen] = (0, $hgUW1$react).useState(false);
4605
- let distribution = {};
4606
- let distribution_array = dataset.distribution ? dataset.distribution : [];
4607
- if (distribution_array.length) distribution = distribution_array.find((dist)=>dist.identifier === distribution_array[distIndex].identifier);
4608
- let buttonRef = null;
4609
- const options = location.search ? {
4610
- ...(0, $hgUW1$qs).parse(location.search, {
4611
- ignoreQueryPrefix: true
4612
- })
4613
- } : {
4614
- conditions: []
4615
- };
4616
- let conditions = options.conditions.length ? options.conditions : [];
4617
- const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
4618
- ...options,
4619
- limit: 25,
4620
- manual: true
4621
- }, additionalParams);
4622
- (0, $hgUW1$useEffect)(()=>{
4623
- if (distribution.identifier) {
4624
- resource.setResource(distribution.identifier);
4625
- resource.setManual(false);
4626
- }
4627
- }, [
4628
- distribution
4629
- ]);
4630
- const downloadUrl = `${rootUrl}/datastore/query/${id}/${distIndex}/download?${(0, $hgUW1$qs).stringify({
4631
- conditions: resource.conditions
4632
- }, {
4633
- encode: true
4634
- })}&format=csv`;
4635
- const pageTitle = distribution.data.title && distribution.data.title.toLowerCase() !== "csv" ? distribution.data.title : dataset.title;
4636
- return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
4637
- className: "ds-l-container ds-u-padding-bottom--3 ds-u-margin-bottom--2",
4638
- children: Object.keys(distribution).length && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
4639
- children: [
4640
- /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Link), {
4641
- to: `/dataset/${id}`,
4642
- className: "ds-u-padding-y--3 ds-u-display--block",
4643
- children: [
4644
- "Back to ",
4645
- dataset.title
4646
- ]
4647
- }),
4648
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
4649
- className: "ds-title",
4650
- children: customTitle ? customTitle : pageTitle
4651
- }),
4652
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4653
- className: "ds-u-margin-top--0 dc-c-metadata-description",
4654
- dangerouslySetInnerHTML: {
4655
- __html: distribution.data.description
4656
- }
4657
- }),
4658
- resource.columns && Object.keys(resource.schema).length && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3b6ca952e79f0695$export$2e2bcd8739ae039), {
4659
- resource: resource,
4660
- id: distribution.identifier,
4661
- customColumns: customColumns
4662
- }),
4663
- resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4664
- children: [
4665
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $af099c546cb226c7$export$2e2bcd8739ae039), {
4666
- includeDensity: true,
4667
- setTablePadding: setTablePadding,
4668
- distribution: distribution,
4669
- resource: resource,
4670
- downloadUrl: downloadUrl,
4671
- tablePadding: tablePadding,
4672
- includeDownload: true
4673
- }),
4674
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $626282d9a03c51d5$export$2e2bcd8739ae039), {
4675
- id: distribution.identifier,
4676
- tablePadding: tablePadding,
4677
- resource: resource,
4678
- customColumns: (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution_array[distIndex].identifier]),
4679
- columnSettings: columnSettings,
4680
- options: {
4681
- layout: "flex",
4682
- columnFilter: false,
4683
- columnSort: true,
4684
- columnResize: true
4685
- },
4686
- columnWidths: columnWidths
4687
- }),
4688
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $072291d44ce1834a$export$2e2bcd8739ae039), {
4689
- resource: resource
4690
- })
4691
- ]
4692
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
4693
- role: "status",
4694
- "aria-valuetext": "Resource loading"
4695
- }),
4696
- dataset.identifier && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4697
- ref: apiDocs,
4698
- children: [
4699
- /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
4700
- children: "Try the API"
4701
- }),
4702
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
4703
- url: `${rootUrl}/metastore/schemas/dataset/items/${dataset.identifier}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
4704
- docExpansion: "list",
4705
- defaultModelsExpandDepth: -1
4706
- })
4707
- ]
4708
- })
4709
- ]
4710
- })
4711
- });
4712
- };
4713
- $dd6eb2b30d7ad75d$var$FilteredResourceBody.defaultProps = {
4714
- apiDocPage: "/api"
4715
- };
4716
- var $dd6eb2b30d7ad75d$export$2e2bcd8739ae039 = $dd6eb2b30d7ad75d$var$FilteredResourceBody;
4717
-
4718
-
4719
-
4720
- 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 })=>{
4721
- const [ready, setReady] = (0, $hgUW1$useState)(false);
4722
- const [error, setError] = (0, $hgUW1$useState)(false);
4723
- const { dataset: dataset } = (0, $68d79598b83f3382$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
4724
- const distIndex = dist_id === "data" ? 0 : dist_id;
4725
- (0, $hgUW1$useEffect)(()=>{
4726
- if (dataset.error) setError(true);
4727
- if (dataset.distribution && dataset.distribution.length) {
4728
- setReady(true);
4729
- if (setDatasetTitle) setDatasetTitle(dataset.title);
4730
- if (!dataset.distribution[distIndex]) setError(true);
4731
- }
4732
- }, [
4733
- dataset.distribution,
4734
- dataset.error,
4735
- distIndex
4736
- ]);
4737
- const notFoundContent = /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4738
- className: "ds-u-padding-top--3",
4739
- children: [
4740
- /*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
4741
- className: "ds-title",
4742
- children: "Error: Dataset not found"
4743
- }),
4744
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4745
- children: "We're sorry, but there is no dataset ID that matches your entry. You may have been directed here because:"
4746
- }),
4747
- /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
4748
- children: [
4749
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
4750
- children: "The address you typed contains a typo;"
4751
- }),
4752
- /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
4753
- children: "The requested dataset no longer exists."
4754
- })
4755
- ]
4756
- }),
4757
- /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
4758
- children: [
4759
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
4760
- className: "ds-u-font-weight--bold",
4761
- children: "Note:"
4762
- }),
4763
- " If you were using a bookmark, please reset it once you find the correct dataset."
4764
- ]
4765
- })
4766
- ]
4767
- });
4768
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
4769
- children: error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
4770
- content: notFoundContent
4771
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
4772
- children: ready && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $dd6eb2b30d7ad75d$export$2e2bcd8739ae039), {
4773
- id: id,
4774
- dataset: dataset,
4775
- distIndex: distIndex,
4776
- location: location,
4777
- apiDocPage: apiDocPage,
4778
- additionalParams: additionalParams,
4779
- customColumns: customColumns ? customColumns : [],
4780
- columnSettings: columnSettings,
4781
- columnWidths: columnWidths,
4782
- customTitle: customTitle,
4783
- rootUrl: rootUrl
4784
- })
4785
- })
4786
- });
4787
- };
4788
- var $f61ecf9f84951a61$export$2e2bcd8739ae039 = $f61ecf9f84951a61$var$FilteredResource;
4789
-
4790
-
4791
-
4792
- const $eb7821d186b1a389$var$useAddLoginLink = (hosts, menuItems, targetKey, loginLinkObj)=>{
4793
- const [linksArray, setLinksArray] = (0, $hgUW1$useState)({
4794
- ...menuItems
4795
- });
4796
- (0, $hgUW1$useEffect)(()=>{
4797
- let localLinks = {
4798
- ...menuItems
4799
- };
4800
- if (hosts.findIndex((host)=>host === window.location.host) > -1) {
4801
- if (localLinks[targetKey].findIndex((link)=>link.id === loginLinkObj.id) === -1) {
4802
- localLinks[targetKey].unshift(loginLinkObj);
4803
- setLinksArray(localLinks);
4804
- }
4805
- }
4806
- }, [
4807
- linksArray
4808
- ]);
4809
- return linksArray;
4810
- };
4811
- var $eb7821d186b1a389$export$2e2bcd8739ae039 = $eb7821d186b1a389$var$useAddLoginLink;
4812
-
4813
-
4814
-
4815
-
4816
- const $90fb213ab8eeb2e7$var$useScrollToTop = ()=>{
4817
- const { pathname: pathname } = (0, $hgUW1$useLocation)();
4818
- (0, $hgUW1$useEffect)(()=>{
4819
- window.scrollTo(0, 0);
4820
- }, [
4821
- pathname
4822
- ]);
4823
- };
4824
- var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollToTop;
4825
-
4826
-
4827
-
4828
-
4829
-
4830
-
4831
- export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $007dd6bfbe0f2956$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, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $dc6d3aaf3e07417b$export$2e2bcd8739ae039 as DatasetSearchListItem, $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, $f61ecf9f84951a61$export$2e2bcd8739ae039 as FilteredResource, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $68d79598b83f3382$export$2e2bcd8739ae039 as useMetastoreDataset, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults};
4832
- //# sourceMappingURL=main.js.map