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