@civicactions/cmsds-open-data-components 2.0.0-alpha.2 → 2.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +2645 -23
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +188 -1
- package/dist/types.d.ts.map +1 -1
- package/lib/commands/templates/header.js +0 -3
- package/lib/templates/DatasetSearch/index.js +28 -8
- package/package.json +6 -3
- package/dist/CMSGovLogo-O.3fac6f9b.png +0 -0
package/dist/main.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {useState as $hgUW1$useState} from "react";
|
|
1
|
+
import {jsxs as $hgUW1$jsxs, jsx as $hgUW1$jsx, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
|
|
2
|
+
import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect} from "react";
|
|
3
|
+
import {Button as $hgUW1$Button, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dropdown as $hgUW1$Dropdown, Spinner as $hgUW1$Spinner, 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} from "@cmsgov/design-system";
|
|
3
4
|
import $hgUW1$proptypes from "prop-types";
|
|
4
|
-
import {NavLink as $hgUW1$NavLink, useNavigate as $hgUW1$useNavigate} from "react-router-dom";
|
|
5
|
+
import {NavLink as $hgUW1$NavLink, useNavigate as $hgUW1$useNavigate, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams, Link as $hgUW1$Link} from "react-router-dom";
|
|
5
6
|
import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
|
|
6
|
-
import
|
|
7
|
+
import $hgUW1$swaggeruireact from "swagger-ui-react";
|
|
8
|
+
import $hgUW1$qs from "qs";
|
|
9
|
+
import $hgUW1$reacttexttruncate from "react-text-truncate";
|
|
10
|
+
import $hgUW1$axios from "axios";
|
|
11
|
+
import "@tanstack/react-table";
|
|
12
|
+
import {usePopper as $hgUW1$usePopper} from "react-popper";
|
|
7
13
|
|
|
8
14
|
function $parcel$interopDefault(a) {
|
|
9
15
|
return a && a.__esModule ? a.default : a;
|
|
@@ -11,17 +17,133 @@ function $parcel$interopDefault(a) {
|
|
|
11
17
|
// Components
|
|
12
18
|
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// import validator from 'validator';
|
|
28
|
+
const $cf8eeac354b9dd32$var$NavLink = ({ link: link , className: className , wrapLabel: wrapLabel })=>{
|
|
29
|
+
const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
30
|
+
children: link.label
|
|
31
|
+
}) : link.label;
|
|
32
|
+
// if (validator.isURL(link.url, { require_protocol: true })) {
|
|
33
|
+
// return (
|
|
34
|
+
// <a className={className} href={link.url}>
|
|
35
|
+
// {innerHtml}
|
|
36
|
+
// </a>
|
|
37
|
+
// );
|
|
38
|
+
// } else {
|
|
39
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
40
|
+
className: ({ isActive: isActive })=>isActive ? `dc-c-active-link ${className}` : `${className}`,
|
|
41
|
+
to: link.url,
|
|
42
|
+
children: innerHtml
|
|
43
|
+
});
|
|
44
|
+
// }
|
|
45
|
+
};
|
|
46
|
+
$cf8eeac354b9dd32$var$NavLink.defaultProps = {
|
|
47
|
+
wrapLabel: false,
|
|
48
|
+
className: null
|
|
49
|
+
};
|
|
50
|
+
$cf8eeac354b9dd32$var$NavLink.propTypes = {
|
|
51
|
+
link: (0, $hgUW1$proptypes).shape({
|
|
52
|
+
url: (0, $hgUW1$proptypes).string,
|
|
53
|
+
label: (0, $hgUW1$proptypes).string
|
|
54
|
+
}).isRequired,
|
|
55
|
+
className: (0, $hgUW1$proptypes).string,
|
|
56
|
+
/**
|
|
57
|
+
* Will wrap the link label in a span for help with styling.
|
|
58
|
+
*/ wrapLabel: (0, $hgUW1$proptypes).bool
|
|
59
|
+
};
|
|
60
|
+
var $cf8eeac354b9dd32$export$2e2bcd8739ae039 = $cf8eeac354b9dd32$var$NavLink;
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const $4f153ca537d853e5$var$SubMenu = ({ link: link , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
|
|
64
|
+
const [isExpanded, setIsExapanded] = (0, $hgUW1$useState)(false);
|
|
65
|
+
const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
66
|
+
children: link.label
|
|
67
|
+
}) : link.label;
|
|
68
|
+
const menu = (0, $hgUW1$useRef)();
|
|
69
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
70
|
+
function handleClickOutside(event) {
|
|
71
|
+
if (menu.current && !menu.current.contains(event.target)) setIsExapanded(false);
|
|
72
|
+
}
|
|
73
|
+
function handleFocusOut(event) {
|
|
74
|
+
if (menu.current && !menu.current.contains(event.relatedTarget)) setIsExapanded(false);
|
|
75
|
+
}
|
|
76
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
77
|
+
menu.current.addEventListener("focusout", handleFocusOut);
|
|
78
|
+
return ()=>{
|
|
79
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
80
|
+
if (menu.current) menu.current.removeEventListener("focusout", handleFocusOut);
|
|
81
|
+
};
|
|
82
|
+
}, [
|
|
83
|
+
menu,
|
|
84
|
+
isExpanded
|
|
85
|
+
]);
|
|
86
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
87
|
+
className: `has-submenu ${isExpanded ? "open" : ""}`,
|
|
88
|
+
ref: menu,
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
91
|
+
size: "small",
|
|
92
|
+
variation: "transparent",
|
|
93
|
+
inversed: true,
|
|
94
|
+
className: linkClasses,
|
|
95
|
+
"aria-haspopup": "true",
|
|
96
|
+
"aria-expanded": isExpanded,
|
|
97
|
+
onClick: (e)=>{
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
setIsExapanded(!isExpanded);
|
|
100
|
+
},
|
|
101
|
+
children: innerHtml
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
104
|
+
className: "dc-c-site-menu--sub-menu",
|
|
105
|
+
children: link.submenu.map((s)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
106
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
|
|
107
|
+
link: s,
|
|
108
|
+
wrapLabel: wrapLabel
|
|
109
|
+
})
|
|
110
|
+
}, s.id))
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
var $4f153ca537d853e5$export$2e2bcd8739ae039 = $4f153ca537d853e5$var$SubMenu;
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
16
119
|
const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menuId: menuId , menuClasses: menuClasses , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
|
|
17
|
-
return /*#__PURE__*/ (0, $hgUW1$
|
|
120
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("nav", {
|
|
18
121
|
className: `dc-c-${menuId}-menu`,
|
|
19
122
|
"aria-labelledby": `dc-c-${menuId}-menu--heading`,
|
|
20
|
-
children:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
125
|
+
id: `dc-c-${menuId}-menu--heading`,
|
|
126
|
+
className: "ds-u-visibility--screen-reader",
|
|
127
|
+
children: menuName
|
|
128
|
+
}),
|
|
129
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
130
|
+
className: menuClasses,
|
|
131
|
+
children: links.map((link)=>{
|
|
132
|
+
if (link.submenu) return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4f153ca537d853e5$export$2e2bcd8739ae039), {
|
|
133
|
+
link: link,
|
|
134
|
+
wrapLabel: wrapLabel,
|
|
135
|
+
linkClasses: linkClasses
|
|
136
|
+
}, link.id);
|
|
137
|
+
else return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
138
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $cf8eeac354b9dd32$export$2e2bcd8739ae039), {
|
|
139
|
+
link: link,
|
|
140
|
+
className: linkClasses,
|
|
141
|
+
wrapLabel: wrapLabel
|
|
142
|
+
})
|
|
143
|
+
}, link.id);
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
]
|
|
25
147
|
});
|
|
26
148
|
};
|
|
27
149
|
$f57121650539d8c5$var$NavBar.defaultProps = {
|
|
@@ -169,7 +291,13 @@ const $ca4d58501b237b60$var$Header = ({ siteName: siteName , headerClasses: head
|
|
|
169
291
|
]
|
|
170
292
|
}),
|
|
171
293
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
172
|
-
className: "ds-u-margin-left--auto"
|
|
294
|
+
className: "ds-u-margin-left--auto",
|
|
295
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f57121650539d8c5$export$2e2bcd8739ae039), {
|
|
296
|
+
links: links.topnav,
|
|
297
|
+
menuName: "CMS Main Header",
|
|
298
|
+
menuId: "cmsheader",
|
|
299
|
+
menuClasses: "ds-u-display--flex dc-c-header--links ds-u-font-size--small"
|
|
300
|
+
})
|
|
173
301
|
})
|
|
174
302
|
]
|
|
175
303
|
}),
|
|
@@ -177,18 +305,36 @@ const $ca4d58501b237b60$var$Header = ({ siteName: siteName , headerClasses: head
|
|
|
177
305
|
className: "dc-c-main-navigation",
|
|
178
306
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
179
307
|
className: "ds-l-container",
|
|
180
|
-
children: /*#__PURE__*/ (0, $hgUW1$
|
|
308
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
181
309
|
className: "ds-l-row ds-u-align-items--center",
|
|
182
|
-
children:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
310
|
+
children: [
|
|
311
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
312
|
+
className: "ds-u-margin-right--5 ds-u-padding-y--3 dc-c-site-title",
|
|
313
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
314
|
+
to: "/",
|
|
315
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
316
|
+
className: "ds-h1",
|
|
317
|
+
children: siteName
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
}),
|
|
321
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $f57121650539d8c5$export$2e2bcd8739ae039), {
|
|
322
|
+
links: links.main,
|
|
323
|
+
wrapLabel: true,
|
|
324
|
+
menuName: "CMS Site Main Nav",
|
|
325
|
+
menuId: "site",
|
|
326
|
+
menuClasses: "ds-u-display--flex dc-c-header--links ds-u-align-items--center",
|
|
327
|
+
linkClasses: linkClasses
|
|
328
|
+
}),
|
|
329
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
330
|
+
className: "dc-c-main-navigation--search ds-u-margin-left--auto ds-u-lg-padding-left--1 ds-u-xl-padding-left--3",
|
|
331
|
+
children: customSearch ? customSearch : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $e5bfafc6d4e6f207$export$2e2bcd8739ae039), {
|
|
332
|
+
searchModalText: searchModalText,
|
|
333
|
+
inversedModalButton: inversedModalButton,
|
|
334
|
+
inversedSearchButton: inversedSearchButton
|
|
189
335
|
})
|
|
190
336
|
})
|
|
191
|
-
|
|
337
|
+
]
|
|
192
338
|
})
|
|
193
339
|
})
|
|
194
340
|
})
|
|
@@ -219,6 +365,25 @@ var $ca4d58501b237b60$export$2e2bcd8739ae039 = $ca4d58501b237b60$var$Header;
|
|
|
219
365
|
|
|
220
366
|
|
|
221
367
|
|
|
368
|
+
|
|
369
|
+
const $c96c4b9ef7203c1f$var$APIPage = ({ hideAuth: hideAuth , additionalParams: additionalParams })=>/*#__PURE__*/ (0, $hgUW1$jsx)("section", {
|
|
370
|
+
className: "ds-l-container",
|
|
371
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
|
|
372
|
+
url: `${undefined}?${hideAuth ? "authentication=false&" : ""}${additionalParams && additionalParams.ACA ? "ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
|
|
373
|
+
docExpansion: "list",
|
|
374
|
+
defaultModelsExpandDepth: -1
|
|
375
|
+
})
|
|
376
|
+
});
|
|
377
|
+
$c96c4b9ef7203c1f$var$APIPage.defaultProps = {
|
|
378
|
+
hideAuth: true
|
|
379
|
+
};
|
|
380
|
+
var $c96c4b9ef7203c1f$export$2e2bcd8739ae039 = $c96c4b9ef7203c1f$var$APIPage;
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
222
387
|
const $026cb986f9fea2b1$var$PageNotFound = ({ siteUrl: siteUrl , content: content })=>{
|
|
223
388
|
return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
|
|
224
389
|
className: "ds-l-container ds-u-padding-top--3",
|
|
@@ -266,6 +431,2463 @@ var $026cb986f9fea2b1$export$2e2bcd8739ae039 = $026cb986f9fea2b1$var$PageNotFoun
|
|
|
266
431
|
|
|
267
432
|
|
|
268
433
|
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
const $bd76a91923d7e8a7$var$TransformedDate = ({ date: date , options: options })=>{
|
|
447
|
+
const rawDate = new Date(date);
|
|
448
|
+
let modifiedDate = "";
|
|
449
|
+
if (rawDate) modifiedDate = rawDate.toLocaleDateString("en-US", options);
|
|
450
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
451
|
+
children: modifiedDate
|
|
452
|
+
});
|
|
453
|
+
};
|
|
454
|
+
$bd76a91923d7e8a7$var$TransformedDate.defaultProps = {
|
|
455
|
+
options: {
|
|
456
|
+
year: "numeric",
|
|
457
|
+
month: "long",
|
|
458
|
+
day: "numeric",
|
|
459
|
+
timeZone: "UTC"
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
var $bd76a91923d7e8a7$export$2e2bcd8739ae039 = $bd76a91923d7e8a7$var$TransformedDate;
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
const $dc6d3aaf3e07417b$var$dangerousDescriptionElement = ({ children: children })=>/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
466
|
+
dangerouslySetInnerHTML: {
|
|
467
|
+
__html: children
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
const $dc6d3aaf3e07417b$var$DatasetSearchListItem = ({ item: item , updateFacets: updateFacets })=>{
|
|
471
|
+
const { title: title , modified: modified , description: description , theme: theme , keyword: keyword , identifier: identifier } = item;
|
|
472
|
+
const truncatedDescription = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reacttexttruncate), {
|
|
473
|
+
line: 3,
|
|
474
|
+
element: "p",
|
|
475
|
+
containerClassName: "ds-u-margin-top--0",
|
|
476
|
+
truncateText: "…",
|
|
477
|
+
textElement: $dc6d3aaf3e07417b$var$dangerousDescriptionElement,
|
|
478
|
+
text: description,
|
|
479
|
+
textTruncateChild: ""
|
|
480
|
+
});
|
|
481
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
482
|
+
className: "dc-dataset-searchlist-item ds-u-border-top--1 ds-u-margin-bottom--5",
|
|
483
|
+
children: [
|
|
484
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
485
|
+
className: "ds-l-row ds-u-padding-top--5",
|
|
486
|
+
children: [
|
|
487
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
488
|
+
className: "ds-l-col--7",
|
|
489
|
+
children: theme && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
490
|
+
className: "ds-u-padding--0 ds-u-display--flex ds-u-flex-direction--row ds-u-flex-wrap--wrap",
|
|
491
|
+
children: theme.map((t)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
492
|
+
className: "ds-u-margin-right--1 ds-u-margin-bottom--1",
|
|
493
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
494
|
+
variation: "info",
|
|
495
|
+
children: t
|
|
496
|
+
})
|
|
497
|
+
}, t))
|
|
498
|
+
})
|
|
499
|
+
}),
|
|
500
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
501
|
+
className: "ds-l-col--5 ds-u-color--gray ds-u-text-align--right",
|
|
502
|
+
children: [
|
|
503
|
+
"Updated ",
|
|
504
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
|
|
505
|
+
date: modified
|
|
506
|
+
})
|
|
507
|
+
]
|
|
508
|
+
})
|
|
509
|
+
]
|
|
510
|
+
}),
|
|
511
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
512
|
+
className: "ds-u-margin-y--1 ds-text-heading--xl",
|
|
513
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
514
|
+
className: "ds-u-color--base",
|
|
515
|
+
to: `/dataset/${identifier}`,
|
|
516
|
+
children: title
|
|
517
|
+
})
|
|
518
|
+
}),
|
|
519
|
+
truncatedDescription,
|
|
520
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
521
|
+
children: keyword && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
522
|
+
className: "ds-u-padding--0 ds-u-display--flex ds-u-flex-wrap--wrap",
|
|
523
|
+
children: keyword.map((k)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
524
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
525
|
+
className: "ds-u-radius ds-u-fill--primary-alt-lightest ds-u-color--base ds-u-margin-right--1 ds-u-margin-bottom--2",
|
|
526
|
+
variation: "info",
|
|
527
|
+
children: k
|
|
528
|
+
})
|
|
529
|
+
}, k))
|
|
530
|
+
})
|
|
531
|
+
})
|
|
532
|
+
]
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
var $dc6d3aaf3e07417b$export$2e2bcd8739ae039 = $dc6d3aaf3e07417b$var$DatasetSearchListItem;
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
function $19c005961efdef1a$export$e4d153b3e021fb47(currentFacet, selectedFacets) {
|
|
543
|
+
let isSelected = -1;
|
|
544
|
+
if (selectedFacets) isSelected = selectedFacets.findIndex((s)=>s === currentFacet);
|
|
545
|
+
return isSelected;
|
|
546
|
+
}
|
|
547
|
+
const $19c005961efdef1a$var$DatasetSearchFacets = ({ title: title , facets: facets , onclickFunction: onclickFunction , selectedFacets: selectedFacets , loading: loading })=>{
|
|
548
|
+
const showLimit = 25;
|
|
549
|
+
const [isOpen, setIsOpen] = (0, $hgUW1$useState)(true);
|
|
550
|
+
const [showMore, setShowMore] = (0, $hgUW1$useState)(false);
|
|
551
|
+
const filteredFacets = facets.filter((f)=>{
|
|
552
|
+
const selectedIndex = selectedFacets.findIndex((item)=>item === f.name);
|
|
553
|
+
return f.total > 0 || selectedIndex !== -1;
|
|
554
|
+
});
|
|
555
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
556
|
+
className: "ds-u-margin-bottom--4 dc-dataset-search--facets-container",
|
|
557
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
|
|
558
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
|
|
559
|
+
contentClassName: "ds-u-padding-left--1 ds-u-padding-right--0",
|
|
560
|
+
heading: `${title} (${filteredFacets.length})`,
|
|
561
|
+
defaultOpen: true,
|
|
562
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
563
|
+
children: filteredFacets.length ? /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
564
|
+
className: "dc-dataset-search--facets ds-u-padding--0 ds-u-margin--0",
|
|
565
|
+
children: filteredFacets.map((f)=>{
|
|
566
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
567
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
|
|
568
|
+
className: "ds-u-margin-y--1",
|
|
569
|
+
checked: $19c005961efdef1a$export$e4d153b3e021fb47(f.name, selectedFacets) > -1 ? true : false,
|
|
570
|
+
name: `facet_theme_${f.name}`,
|
|
571
|
+
type: "checkbox",
|
|
572
|
+
label: `${f.name} (${f.total})`,
|
|
573
|
+
value: f.name,
|
|
574
|
+
onClick: (e)=>onclickFunction({
|
|
575
|
+
key: f.type,
|
|
576
|
+
value: e.target.value
|
|
577
|
+
})
|
|
578
|
+
})
|
|
579
|
+
}, f.name);
|
|
580
|
+
})
|
|
581
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
582
|
+
className: "ds-h5",
|
|
583
|
+
children: "No matching facets found."
|
|
584
|
+
})
|
|
585
|
+
})
|
|
586
|
+
})
|
|
587
|
+
})
|
|
588
|
+
});
|
|
589
|
+
};
|
|
590
|
+
$19c005961efdef1a$var$DatasetSearchFacets.defaultProps = {
|
|
591
|
+
selectedFacets: []
|
|
592
|
+
};
|
|
593
|
+
$19c005961efdef1a$var$DatasetSearchFacets.propTypes = {
|
|
594
|
+
title: (0, $hgUW1$proptypes).string.isRequired,
|
|
595
|
+
facets: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
|
|
596
|
+
type: (0, $hgUW1$proptypes).string.isRequired,
|
|
597
|
+
name: (0, $hgUW1$proptypes).string.isRequired,
|
|
598
|
+
total: (0, $hgUW1$proptypes).oneOfType([
|
|
599
|
+
(0, $hgUW1$proptypes).number,
|
|
600
|
+
(0, $hgUW1$proptypes).string
|
|
601
|
+
]).isRequired
|
|
602
|
+
})).isRequired,
|
|
603
|
+
onclickFunction: (0, $hgUW1$proptypes).func.isRequired
|
|
604
|
+
};
|
|
605
|
+
var $19c005961efdef1a$export$2e2bcd8739ae039 = $19c005961efdef1a$var$DatasetSearchFacets;
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
function $116bd29db288848e$export$959638e8dca60ce6(facets) {
|
|
612
|
+
let facetObj = {};
|
|
613
|
+
facets.forEach((f)=>{
|
|
614
|
+
if (facetObj[f.type]) facetObj[f.type] = [
|
|
615
|
+
...facetObj[f.type],
|
|
616
|
+
f
|
|
617
|
+
];
|
|
618
|
+
else facetObj[f.type] = [
|
|
619
|
+
f
|
|
620
|
+
];
|
|
621
|
+
});
|
|
622
|
+
return facetObj;
|
|
623
|
+
}
|
|
624
|
+
function $116bd29db288848e$export$73b41a3a66d60730(currentFacet, selectedFacets) {
|
|
625
|
+
const isInSelectedFacets = selectedFacets[currentFacet.key] ? selectedFacets[currentFacet.key].indexOf(currentFacet.value) : -1;
|
|
626
|
+
return isInSelectedFacets;
|
|
627
|
+
}
|
|
628
|
+
function $116bd29db288848e$export$9ef1e909a5e43470(currentFacet, selectedFacets) {
|
|
629
|
+
const key = currentFacet["key"];
|
|
630
|
+
let newFacetList = {
|
|
631
|
+
...selectedFacets
|
|
632
|
+
};
|
|
633
|
+
if (newFacetList[key]) {
|
|
634
|
+
const existingFacet = $116bd29db288848e$export$73b41a3a66d60730(currentFacet, newFacetList);
|
|
635
|
+
if (existingFacet > -1) newFacetList[key].splice(existingFacet, 1);
|
|
636
|
+
else newFacetList[key] = [
|
|
637
|
+
...newFacetList[key],
|
|
638
|
+
currentFacet.value
|
|
639
|
+
];
|
|
640
|
+
} else newFacetList[key] = [
|
|
641
|
+
currentFacet.value
|
|
642
|
+
];
|
|
643
|
+
return newFacetList;
|
|
644
|
+
}
|
|
645
|
+
async function $116bd29db288848e$export$2d2256cb46e92ff7(rootUrl, options, additionalParams) {
|
|
646
|
+
const { fulltext: fulltext , selectedFacets: selectedFacets , sort: sort , sortOrder: sortOrder , page: page , pageSize: pageSize } = options;
|
|
647
|
+
let params = {
|
|
648
|
+
fulltext: fulltext ? fulltext : undefined,
|
|
649
|
+
...selectedFacets,
|
|
650
|
+
sort: sort ? sort : undefined,
|
|
651
|
+
["sort-order"]: sortOrder ? sortOrder : undefined,
|
|
652
|
+
page: page !== 1 ? page : undefined,
|
|
653
|
+
["page-size"]: pageSize !== 10 ? pageSize : undefined,
|
|
654
|
+
...additionalParams
|
|
655
|
+
};
|
|
656
|
+
return await (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify(params, {
|
|
657
|
+
arrayFormat: "comma",
|
|
658
|
+
encode: false,
|
|
659
|
+
skipEmptyString: true
|
|
660
|
+
})}`);
|
|
661
|
+
}
|
|
662
|
+
function $116bd29db288848e$export$28fa7926a3fa4176(selectedFacets, fulltext, sort) {
|
|
663
|
+
let newParams = {
|
|
664
|
+
...selectedFacets
|
|
665
|
+
};
|
|
666
|
+
if (fulltext) newParams.fulltext = fulltext;
|
|
667
|
+
if (sort) newParams.sort = sort;
|
|
668
|
+
return (0, $hgUW1$qs).stringify(newParams, {
|
|
669
|
+
addQueryPrefix: true,
|
|
670
|
+
encode: false,
|
|
671
|
+
arrayFormat: "brackets"
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
const $efc410f5f7ac5ef3$var$useSearchAPI = (rootUrl, initialSearchParams = {}, additionalParams = {})=>{
|
|
677
|
+
const defaultSort = "";
|
|
678
|
+
const defaultFulltext = "";
|
|
679
|
+
const defaultSelectedFacets = {};
|
|
680
|
+
const defaultSortOrder = "";
|
|
681
|
+
const defaultPage = 1;
|
|
682
|
+
const defaultPageSize = 10;
|
|
683
|
+
const sortOptions = [
|
|
684
|
+
"modified",
|
|
685
|
+
"title"
|
|
686
|
+
];
|
|
687
|
+
const sortOrderOptions = [
|
|
688
|
+
"asc",
|
|
689
|
+
"desc"
|
|
690
|
+
];
|
|
691
|
+
const [items, setItems] = (0, $hgUW1$useState)([]);
|
|
692
|
+
const [facets, setFacets] = (0, $hgUW1$useState)([]);
|
|
693
|
+
const [loading, setLoading] = (0, $hgUW1$useState)(false);
|
|
694
|
+
const [totalItems, setTotalItems] = (0, $hgUW1$useState)(null);
|
|
695
|
+
const [selectedFacets, setSelectedFacets] = (0, $hgUW1$useState)(initialSearchParams.selectedFacets ? initialSearchParams.selectedFacets : defaultSelectedFacets);
|
|
696
|
+
const [fulltext, setFulltext] = (0, $hgUW1$useState)(initialSearchParams.fulltext ? initialSearchParams.fulltext : defaultFulltext);
|
|
697
|
+
const [sort, setSort] = (0, $hgUW1$useState)(initialSearchParams.sort ? initialSearchParams.sort : defaultSort);
|
|
698
|
+
const [sortOrder, setSortOrder] = (0, $hgUW1$useState)(initialSearchParams.sortOrder ? initialSearchParams.sortOrder : defaultSortOrder);
|
|
699
|
+
const [page, setPage] = (0, $hgUW1$useState)(initialSearchParams.page ? initialSearchParams.page : defaultPage);
|
|
700
|
+
const [pageSize, setPageSize] = (0, $hgUW1$useState)(initialSearchParams.pageSize ? initialSearchParams.pageSize : defaultPageSize);
|
|
701
|
+
async function search() {
|
|
702
|
+
const options = {
|
|
703
|
+
fulltext: fulltext,
|
|
704
|
+
selectedFacets: selectedFacets,
|
|
705
|
+
sort: sort,
|
|
706
|
+
sortOrder: sortOrder,
|
|
707
|
+
page: Number(page),
|
|
708
|
+
pageSize: pageSize
|
|
709
|
+
};
|
|
710
|
+
const results = await (0, $116bd29db288848e$export$2d2256cb46e92ff7)(rootUrl, options, additionalParams);
|
|
711
|
+
const itemKeys = Object.keys(results.data.results);
|
|
712
|
+
const itemsArray = itemKeys.map((key)=>{
|
|
713
|
+
return results.data.results[key];
|
|
714
|
+
});
|
|
715
|
+
setFacets(results.data.facets);
|
|
716
|
+
setItems(itemsArray);
|
|
717
|
+
setTotalItems(results.data.total);
|
|
718
|
+
setLoading(false);
|
|
719
|
+
}
|
|
720
|
+
function resetFilters() {
|
|
721
|
+
setFulltext(defaultFulltext);
|
|
722
|
+
setSelectedFacets(defaultSelectedFacets);
|
|
723
|
+
setPage(defaultPage);
|
|
724
|
+
}
|
|
725
|
+
function updateSelectedFacets(currentFacet) {
|
|
726
|
+
const facets = (0, $116bd29db288848e$export$9ef1e909a5e43470)(currentFacet, selectedFacets);
|
|
727
|
+
setSelectedFacets(facets);
|
|
728
|
+
}
|
|
729
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
730
|
+
if (totalItems !== null) setPage(1);
|
|
731
|
+
}, [
|
|
732
|
+
fulltext,
|
|
733
|
+
selectedFacets,
|
|
734
|
+
pageSize
|
|
735
|
+
]);
|
|
736
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
737
|
+
const timer = setTimeout(()=>{
|
|
738
|
+
setLoading(true);
|
|
739
|
+
search();
|
|
740
|
+
}, 1000);
|
|
741
|
+
return ()=>clearTimeout(timer);
|
|
742
|
+
}, [
|
|
743
|
+
fulltext,
|
|
744
|
+
selectedFacets,
|
|
745
|
+
sort,
|
|
746
|
+
sortOrder,
|
|
747
|
+
page,
|
|
748
|
+
pageSize
|
|
749
|
+
]);
|
|
750
|
+
return {
|
|
751
|
+
fulltext: fulltext,
|
|
752
|
+
selectedFacets: selectedFacets,
|
|
753
|
+
sortOptions: sortOptions,
|
|
754
|
+
sortOrderOptions: sortOrderOptions,
|
|
755
|
+
items: items,
|
|
756
|
+
facets: facets,
|
|
757
|
+
loading: loading,
|
|
758
|
+
totalItems: totalItems,
|
|
759
|
+
sort: sort,
|
|
760
|
+
sortOrder: sortOrder,
|
|
761
|
+
page: page,
|
|
762
|
+
pageSize: pageSize,
|
|
763
|
+
setPage: setPage,
|
|
764
|
+
setPageSize: setPageSize,
|
|
765
|
+
setSort: setSort,
|
|
766
|
+
setSortOrder: setSortOrder,
|
|
767
|
+
updateSelectedFacets: updateSelectedFacets,
|
|
768
|
+
setFulltext: setFulltext,
|
|
769
|
+
resetFilters: resetFilters
|
|
770
|
+
};
|
|
771
|
+
};
|
|
772
|
+
var $efc410f5f7ac5ef3$export$2e2bcd8739ae039 = $efc410f5f7ac5ef3$var$useSearchAPI;
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
function $007dd6bfbe0f2956$export$b638ec7c7eac7f18(facets, alternateTitles) {
|
|
779
|
+
let message = [];
|
|
780
|
+
const keys = Object.keys(facets);
|
|
781
|
+
keys.forEach((k)=>{
|
|
782
|
+
if (facets[k].length) message.push(`${alternateTitles[k]}: ${facets[k].join(", ")}`);
|
|
783
|
+
});
|
|
784
|
+
return message.join(" & ");
|
|
785
|
+
}
|
|
786
|
+
function $007dd6bfbe0f2956$export$60ec7cc1d341a524(searchParams, facetList, defaultSortOptions) {
|
|
787
|
+
const params = (0, $hgUW1$qs).parse(searchParams, {
|
|
788
|
+
ignoreQueryPrefix: true
|
|
789
|
+
});
|
|
790
|
+
const selectedFacets = {};
|
|
791
|
+
facetList.forEach((facet)=>{
|
|
792
|
+
selectedFacets[facet] = params[facet] ? params[facet] : [];
|
|
793
|
+
});
|
|
794
|
+
return {
|
|
795
|
+
page: params.page,
|
|
796
|
+
sort: !params.sort ? defaultSortOptions.defaultSort : params.sort,
|
|
797
|
+
sortOrder: !params.sortOrder ? defaultSortOptions.defaultOrder : params.sortOrder,
|
|
798
|
+
fulltext: params.fulltext,
|
|
799
|
+
selectedFacets: selectedFacets
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
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 })=>{
|
|
803
|
+
const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)(null);
|
|
804
|
+
const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
|
|
805
|
+
const location = (0, $hgUW1$useLocation)();
|
|
806
|
+
let [searchParams, setSearchParams] = (0, $hgUW1$useSearchParams)();
|
|
807
|
+
const [filterText, setFilterText] = (0, $hgUW1$useState)("");
|
|
808
|
+
const { fulltext: fulltext , selectedFacets: selectedFacets , loading: loading , items: items , sort: sort , totalItems: totalItems , facets: facets , updateSelectedFacets: updateSelectedFacets , setFulltext: setFulltext , setSort: setSort , sortOrder: sortOrder , setSortOrder: setSortOrder , setPage: setPage , pageSize: pageSize , page: page , resetFilters: resetFilters } = (0, $efc410f5f7ac5ef3$export$2e2bcd8739ae039)(rootUrl, {
|
|
809
|
+
...$007dd6bfbe0f2956$export$60ec7cc1d341a524(location.search, [
|
|
810
|
+
"theme",
|
|
811
|
+
"keyword"
|
|
812
|
+
], defaultSort)
|
|
813
|
+
}, additionalParams);
|
|
814
|
+
const { theme: theme , keyword: keyword } = (0, $116bd29db288848e$export$959638e8dca60ce6)(facets);
|
|
815
|
+
function buildSearchParams(includePage) {
|
|
816
|
+
let newParams = {};
|
|
817
|
+
if (Number(page) !== 1 && includePage) newParams.page = page;
|
|
818
|
+
if (sort !== defaultSort.defaultSort) newParams.sort = sort;
|
|
819
|
+
if (sortOrder !== defaultSort.defaultOrder) newParams.sortOrder = sortOrder;
|
|
820
|
+
if (fulltext !== "") newParams.fulltext = fulltext;
|
|
821
|
+
if (Object.keys(selectedFacets).length) Object.keys(selectedFacets).forEach((key)=>{
|
|
822
|
+
newParams[key] = selectedFacets[key];
|
|
823
|
+
});
|
|
824
|
+
return (0, $hgUW1$qs).stringify(newParams, {
|
|
825
|
+
addQueryPrefix: includePage,
|
|
826
|
+
encode: true
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
830
|
+
if (fulltext !== filterText) setFilterText(fulltext);
|
|
831
|
+
}, [
|
|
832
|
+
fulltext
|
|
833
|
+
]);
|
|
834
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
835
|
+
var params = buildSearchParams(true);
|
|
836
|
+
if (params !== location.search) setSearchParams(params);
|
|
837
|
+
}, [
|
|
838
|
+
page,
|
|
839
|
+
sort,
|
|
840
|
+
sortOrder,
|
|
841
|
+
fulltext,
|
|
842
|
+
selectedFacets
|
|
843
|
+
]);
|
|
844
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
845
|
+
const baseNumber = Number(totalItems) > 0 ? 1 : 0;
|
|
846
|
+
const startingNumber = baseNumber + (Number(pageSize) * Number(page) - Number(pageSize));
|
|
847
|
+
const endingNumber = Number(pageSize) * Number(page);
|
|
848
|
+
setCurrentResultNumbers({
|
|
849
|
+
total: Number(totalItems),
|
|
850
|
+
startingNumber: Number(totalItems) >= startingNumber ? startingNumber : 0,
|
|
851
|
+
endingNumber: Number(totalItems) < endingNumber ? Number(totalItems) : endingNumber
|
|
852
|
+
});
|
|
853
|
+
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
854
|
+
else setNoResults(false);
|
|
855
|
+
}, [
|
|
856
|
+
totalItems,
|
|
857
|
+
pageSize,
|
|
858
|
+
page
|
|
859
|
+
]);
|
|
860
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("section", {
|
|
861
|
+
className: "ds-l-container",
|
|
862
|
+
children: [
|
|
863
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
|
|
864
|
+
className: "dc-search-header ds-title ds-u-margin-y--3",
|
|
865
|
+
children: pageTitle
|
|
866
|
+
}),
|
|
867
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
868
|
+
className: "ds-l-row",
|
|
869
|
+
children: [
|
|
870
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
871
|
+
className: "ds-l-md-col--8 ds-l-sm-col--12ds-u-margin-bottom--3",
|
|
872
|
+
children: [
|
|
873
|
+
introText ? introText : null,
|
|
874
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
|
|
875
|
+
onSubmit: (e)=>{
|
|
876
|
+
e.preventDefault();
|
|
877
|
+
()=>setFulltext(filterText);
|
|
878
|
+
},
|
|
879
|
+
className: formClassName,
|
|
880
|
+
children: [
|
|
881
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
|
|
882
|
+
fieldClassName: "ds-u-margin--0",
|
|
883
|
+
value: filterText,
|
|
884
|
+
className: "dc-fulltext--input-container ds-u-padding-right--2",
|
|
885
|
+
label: fulltextLabel,
|
|
886
|
+
labelClassName: fulltextLabelClassName,
|
|
887
|
+
placeholder: fulltextPlaceholder,
|
|
888
|
+
name: "dataset_fulltext_search",
|
|
889
|
+
onChange: (e)=>setFilterText(e.target.value)
|
|
890
|
+
}),
|
|
891
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
892
|
+
type: "submit",
|
|
893
|
+
htmlFor: "dataset_fulltext_search",
|
|
894
|
+
variation: "primary",
|
|
895
|
+
onClick: ()=>setFulltext(filterText),
|
|
896
|
+
children: "Search"
|
|
897
|
+
})
|
|
898
|
+
]
|
|
899
|
+
}),
|
|
900
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
901
|
+
className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--end",
|
|
902
|
+
children: [
|
|
903
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
904
|
+
children: [
|
|
905
|
+
currentResultNumbers && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
|
|
906
|
+
className: "ds-u-margin-y--0",
|
|
907
|
+
children: [
|
|
908
|
+
"Showing ",
|
|
909
|
+
currentResultNumbers.startingNumber,
|
|
910
|
+
" -",
|
|
911
|
+
" ",
|
|
912
|
+
currentResultNumbers.endingNumber,
|
|
913
|
+
" of ",
|
|
914
|
+
currentResultNumbers.total,
|
|
915
|
+
" datasets"
|
|
916
|
+
]
|
|
917
|
+
}),
|
|
918
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
919
|
+
className: "ds-u-margin-y--0",
|
|
920
|
+
children: $007dd6bfbe0f2956$export$b638ec7c7eac7f18(selectedFacets, {
|
|
921
|
+
theme: "Categories",
|
|
922
|
+
keyword: "Tags"
|
|
923
|
+
})
|
|
924
|
+
})
|
|
925
|
+
]
|
|
926
|
+
}),
|
|
927
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
928
|
+
className: "ds-u-padding--0 dc-c-clear-filters",
|
|
929
|
+
variation: "transparent",
|
|
930
|
+
onClick: ()=>resetFilters(),
|
|
931
|
+
children: "Clear all filters"
|
|
932
|
+
})
|
|
933
|
+
]
|
|
934
|
+
}),
|
|
935
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
|
|
936
|
+
className: "dc-dataset-search-list ds-u-padding--0",
|
|
937
|
+
children: [
|
|
938
|
+
noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
939
|
+
variation: "error",
|
|
940
|
+
heading: "No results found."
|
|
941
|
+
}),
|
|
942
|
+
items.map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
943
|
+
className: "ds-u-padding--0",
|
|
944
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $dc6d3aaf3e07417b$export$2e2bcd8739ae039), {
|
|
945
|
+
item: item,
|
|
946
|
+
updateFacets: updateSelectedFacets
|
|
947
|
+
})
|
|
948
|
+
}, item.identifier))
|
|
949
|
+
]
|
|
950
|
+
}),
|
|
951
|
+
totalItems && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
|
|
952
|
+
id: "test-default",
|
|
953
|
+
currentPage: Number(page),
|
|
954
|
+
totalPages: Math.ceil(Number(totalItems) / pageSize),
|
|
955
|
+
onPageChange: (evt, page)=>{
|
|
956
|
+
evt.preventDefault();
|
|
957
|
+
window.scroll(0, 0);
|
|
958
|
+
setPage(page);
|
|
959
|
+
},
|
|
960
|
+
renderHref: (page)=>{
|
|
961
|
+
const searchParams = buildSearchParams(false);
|
|
962
|
+
const includeAnd = searchParams ? "&" : "";
|
|
963
|
+
return `/datasets?page=${page}${includeAnd}${searchParams}`;
|
|
964
|
+
}
|
|
965
|
+
})
|
|
966
|
+
]
|
|
967
|
+
}),
|
|
968
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
969
|
+
className: "ds-l-md-col--4 ds-l-sm-col--12",
|
|
970
|
+
children: [
|
|
971
|
+
showSort && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
972
|
+
className: "ds-u-padding--2 ds-u-margin-bottom--4 ds-u-border--1",
|
|
973
|
+
children: [
|
|
974
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
975
|
+
options: sortOptions,
|
|
976
|
+
value: sort,
|
|
977
|
+
label: "Sort by",
|
|
978
|
+
labelClassName: "ds-u-margin-top--0",
|
|
979
|
+
name: "dataset_search_sort",
|
|
980
|
+
onChange: (e)=>setSort(e.target.value)
|
|
981
|
+
}),
|
|
982
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
983
|
+
options: [
|
|
984
|
+
{
|
|
985
|
+
label: "Ascending",
|
|
986
|
+
value: "asc"
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
label: "Descending",
|
|
990
|
+
value: "desc"
|
|
991
|
+
}
|
|
992
|
+
],
|
|
993
|
+
value: sortOrder,
|
|
994
|
+
label: "Sort order",
|
|
995
|
+
labelClassName: "ds-u-margin-top--0",
|
|
996
|
+
name: "dataset_search_sort_order",
|
|
997
|
+
onChange: (e)=>setSortOrder(e.target.value)
|
|
998
|
+
})
|
|
999
|
+
]
|
|
1000
|
+
}),
|
|
1001
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1002
|
+
className: "ds-u-padding--2 ds-u-margin-bottom--4 ds-u-border--1",
|
|
1003
|
+
children: [
|
|
1004
|
+
theme ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $19c005961efdef1a$export$2e2bcd8739ae039), {
|
|
1005
|
+
title: "Categories",
|
|
1006
|
+
facets: theme,
|
|
1007
|
+
onclickFunction: updateSelectedFacets,
|
|
1008
|
+
selectedFacets: selectedFacets.theme,
|
|
1009
|
+
loading: loading
|
|
1010
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
1011
|
+
className: "ds-u-valign--middle",
|
|
1012
|
+
"aria-valuetext": "Categories loading",
|
|
1013
|
+
role: "status"
|
|
1014
|
+
}),
|
|
1015
|
+
keyword ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $19c005961efdef1a$export$2e2bcd8739ae039), {
|
|
1016
|
+
title: "Tags",
|
|
1017
|
+
facets: keyword,
|
|
1018
|
+
onclickFunction: updateSelectedFacets,
|
|
1019
|
+
selectedFacets: selectedFacets.keyword,
|
|
1020
|
+
loading: loading
|
|
1021
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
1022
|
+
className: "ds-u-valign--middle",
|
|
1023
|
+
"aria-valuetext": "Tags loading",
|
|
1024
|
+
role: "status"
|
|
1025
|
+
})
|
|
1026
|
+
]
|
|
1027
|
+
})
|
|
1028
|
+
]
|
|
1029
|
+
})
|
|
1030
|
+
]
|
|
1031
|
+
})
|
|
1032
|
+
]
|
|
1033
|
+
});
|
|
1034
|
+
};
|
|
1035
|
+
$007dd6bfbe0f2956$var$DatasetSearch.defaultProps = {
|
|
1036
|
+
pageTitle: "Datasets",
|
|
1037
|
+
introText: "",
|
|
1038
|
+
fulltextLabel: "Search term",
|
|
1039
|
+
fulltextLabelClassName: "ds-u-visibility--screen-reader",
|
|
1040
|
+
fulltextPlaceholder: "Type search term here",
|
|
1041
|
+
formClassName: "ds-u-display--flex ds-u-justify-content--between ds-u-margin-bottom--2",
|
|
1042
|
+
showSort: true,
|
|
1043
|
+
sortOptions: [
|
|
1044
|
+
{
|
|
1045
|
+
label: "Recently Updated",
|
|
1046
|
+
value: "modified"
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
label: "Title",
|
|
1050
|
+
value: "title"
|
|
1051
|
+
}
|
|
1052
|
+
],
|
|
1053
|
+
defaultSort: {
|
|
1054
|
+
defaultSort: "modified",
|
|
1055
|
+
defaultOrder: "desc"
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
var $007dd6bfbe0f2956$export$2e2bcd8739ae039 = $007dd6bfbe0f2956$var$DatasetSearch;
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
const $68d79598b83f3382$var$useMetastoreDataset = (datasetId, rootAPIUrl, additionalParams = {})=>{
|
|
1070
|
+
const [dataset, setDataset] = (0, $hgUW1$useState)({});
|
|
1071
|
+
const [id, setId] = (0, $hgUW1$useState)(datasetId);
|
|
1072
|
+
const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
|
|
1073
|
+
const additionalParamsString = Object.keys(additionalParams).length ? `&${(0, $hgUW1$qs).stringify(additionalParams)}` : "";
|
|
1074
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1075
|
+
async function fetchData() {
|
|
1076
|
+
return (0, $hgUW1$axios).get(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>setDataset(res.data)).catch((error)=>setDataset({
|
|
1077
|
+
error: error
|
|
1078
|
+
}));
|
|
1079
|
+
}
|
|
1080
|
+
fetchData();
|
|
1081
|
+
}, [
|
|
1082
|
+
id,
|
|
1083
|
+
rootUrl
|
|
1084
|
+
]);
|
|
1085
|
+
return {
|
|
1086
|
+
dataset: dataset,
|
|
1087
|
+
setId: setId,
|
|
1088
|
+
setRootUrl: setRootUrl
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
var $68d79598b83f3382$export$2e2bcd8739ae039 = $68d79598b83f3382$var$useMetastoreDataset;
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
async function $0e7628cf73c71646$export$55f990b5477765d6(id, rootUrl, options, additionalParams) {
|
|
1105
|
+
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;
|
|
1106
|
+
if (!id) // TODO: Throw error
|
|
1107
|
+
return false;
|
|
1108
|
+
if (typeof setLoading === "function") setLoading(true);
|
|
1109
|
+
console.log(rootUrl);
|
|
1110
|
+
return await (0, $hgUW1$axios)({
|
|
1111
|
+
method: "GET",
|
|
1112
|
+
url: `${rootUrl}/datastore/query/${id}`,
|
|
1113
|
+
params: {
|
|
1114
|
+
keys: keys,
|
|
1115
|
+
limit: limit,
|
|
1116
|
+
offset: offset,
|
|
1117
|
+
conditions: conditions,
|
|
1118
|
+
sorts: sort,
|
|
1119
|
+
properties: properties,
|
|
1120
|
+
groupings: groupings,
|
|
1121
|
+
...additionalParams
|
|
1122
|
+
},
|
|
1123
|
+
paramsSerializer: {
|
|
1124
|
+
serialize: (0, $hgUW1$qs).stringify
|
|
1125
|
+
}
|
|
1126
|
+
}).then((res)=>{
|
|
1127
|
+
const { data: data } = res;
|
|
1128
|
+
console.log(res);
|
|
1129
|
+
const propertyKeys = data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
|
|
1130
|
+
setValues(data.results), setCount(data.count);
|
|
1131
|
+
if (propertyKeys.length) setColumns(prepareColumns ? prepareColumns(propertyKeys) : propertyKeys);
|
|
1132
|
+
setSchema(data.schema);
|
|
1133
|
+
if (typeof setLoading === "function") setLoading(false);
|
|
1134
|
+
return data;
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, additionalParams = {})=>{
|
|
1140
|
+
const keys = options.keys ? options.keys : true;
|
|
1141
|
+
const { prepareColumns: prepareColumns } = options;
|
|
1142
|
+
const [manual, setManual] = (0, $hgUW1$useState)(options.manual ? options.manual : false);
|
|
1143
|
+
const [requireConditions, setRequireConditions] = (0, $hgUW1$useState)(options.requireConditions ? options.requireConditions : false);
|
|
1144
|
+
const [values, setValues] = (0, $hgUW1$useState)([]);
|
|
1145
|
+
const [id, setResource] = (0, $hgUW1$useState)(resourceId);
|
|
1146
|
+
const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
|
|
1147
|
+
const [limit, setLimit] = (0, $hgUW1$useState)(options.limit ? options.limit : 20);
|
|
1148
|
+
const [count, setCount] = (0, $hgUW1$useState)(null);
|
|
1149
|
+
const [columns, setColumns] = (0, $hgUW1$useState)([]);
|
|
1150
|
+
const [offset, setOffset] = (0, $hgUW1$useState)(options.offset ? options.offset : 0);
|
|
1151
|
+
const [loading, setLoading] = (0, $hgUW1$useState)(false);
|
|
1152
|
+
const [conditions, setConditions] = (0, $hgUW1$useState)(options.conditions ? options.conditions : undefined);
|
|
1153
|
+
const [sort, setSort] = (0, $hgUW1$useState)(options.sort ? options.sort : undefined);
|
|
1154
|
+
const [groupings, setGroupings] = (0, $hgUW1$useState)(options.groupings ? options.groupings : undefined);
|
|
1155
|
+
const [schema, setSchema] = (0, $hgUW1$useState)({});
|
|
1156
|
+
// const [joins, setJoins] = useState()
|
|
1157
|
+
const [properties, setProperties] = (0, $hgUW1$useState)(options.properties ? options.properties : undefined);
|
|
1158
|
+
const prevLimitRef = (0, $hgUW1$useRef)();
|
|
1159
|
+
const prevOffsetRef = (0, $hgUW1$useRef)();
|
|
1160
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1161
|
+
prevLimitRef.current = limit;
|
|
1162
|
+
prevOffsetRef.current = offset;
|
|
1163
|
+
});
|
|
1164
|
+
const prevLimit = prevLimitRef.current;
|
|
1165
|
+
const prevOffset = prevOffsetRef.current;
|
|
1166
|
+
function fetchData() {
|
|
1167
|
+
let newOffset = prevLimit === limit ? prevOffset !== offset ? offset : 0 : 0;
|
|
1168
|
+
setOffset(newOffset);
|
|
1169
|
+
(0, $0e7628cf73c71646$export$55f990b5477765d6)(id, rootUrl, {
|
|
1170
|
+
keys: keys,
|
|
1171
|
+
limit: limit,
|
|
1172
|
+
offset: newOffset,
|
|
1173
|
+
conditions: conditions,
|
|
1174
|
+
sort: sort,
|
|
1175
|
+
groupings: groupings,
|
|
1176
|
+
prepareColumns: prepareColumns,
|
|
1177
|
+
properties: properties,
|
|
1178
|
+
setValues: setValues,
|
|
1179
|
+
setCount: setCount,
|
|
1180
|
+
setColumns: setColumns,
|
|
1181
|
+
setLoading: setLoading,
|
|
1182
|
+
setSchema: setSchema,
|
|
1183
|
+
setProperties: setProperties
|
|
1184
|
+
}, additionalParams);
|
|
1185
|
+
}
|
|
1186
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1187
|
+
if (!loading && !manual) {
|
|
1188
|
+
if (!requireConditions) fetchData();
|
|
1189
|
+
else if (requireConditions) {
|
|
1190
|
+
if (conditions && conditions.length) fetchData();
|
|
1191
|
+
else {
|
|
1192
|
+
setCount(null);
|
|
1193
|
+
setValues([]);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}, [
|
|
1198
|
+
id,
|
|
1199
|
+
rootUrl,
|
|
1200
|
+
offset,
|
|
1201
|
+
conditions,
|
|
1202
|
+
sort,
|
|
1203
|
+
limit,
|
|
1204
|
+
requireConditions
|
|
1205
|
+
]);
|
|
1206
|
+
return {
|
|
1207
|
+
loading: loading,
|
|
1208
|
+
values: values,
|
|
1209
|
+
count: count,
|
|
1210
|
+
columns: columns,
|
|
1211
|
+
limit: limit,
|
|
1212
|
+
offset: offset,
|
|
1213
|
+
schema: schema,
|
|
1214
|
+
conditions: conditions,
|
|
1215
|
+
properties: properties,
|
|
1216
|
+
setProperties: setProperties,
|
|
1217
|
+
setGroupings: setGroupings,
|
|
1218
|
+
setResource: setResource,
|
|
1219
|
+
setRootUrl: setRootUrl,
|
|
1220
|
+
setLimit: setLimit,
|
|
1221
|
+
setOffset: setOffset,
|
|
1222
|
+
setConditions: setConditions,
|
|
1223
|
+
setSort: setSort,
|
|
1224
|
+
setManual: setManual,
|
|
1225
|
+
setRequireConditions: setRequireConditions,
|
|
1226
|
+
fetchData: fetchData
|
|
1227
|
+
};
|
|
1228
|
+
};
|
|
1229
|
+
var $1d3d480a9cfaabe0$export$2e2bcd8739ae039 = $1d3d480a9cfaabe0$var$useDatastore;
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
// OPERATORS
|
|
1238
|
+
// =
|
|
1239
|
+
// <> not equal to
|
|
1240
|
+
// BETWEEN
|
|
1241
|
+
// IN
|
|
1242
|
+
// NOT IN
|
|
1243
|
+
// >=
|
|
1244
|
+
// <=
|
|
1245
|
+
// like
|
|
1246
|
+
function $ead72e621d62e6fc$export$64030b8086b23b59(filterArray) {
|
|
1247
|
+
const conditions = filterArray.map((f)=>{
|
|
1248
|
+
return {
|
|
1249
|
+
resource: "t",
|
|
1250
|
+
property: f.id,
|
|
1251
|
+
value: `%${f.value}%`,
|
|
1252
|
+
operator: "LIKE"
|
|
1253
|
+
};
|
|
1254
|
+
});
|
|
1255
|
+
return conditions;
|
|
1256
|
+
}
|
|
1257
|
+
function $ead72e621d62e6fc$export$5bccb6115193eb03(filterArray) {
|
|
1258
|
+
if (!filterArray || filterArray.length === 0) return "";
|
|
1259
|
+
const where_clauses = [];
|
|
1260
|
+
filterArray.forEach((v, i)=>{
|
|
1261
|
+
// Switch delimiter to, and strip any double-quote for Dkan2's sql query.
|
|
1262
|
+
let value = `%25${v.value}%25`;
|
|
1263
|
+
where_clauses[i] = `${v.id} = "${v.value.replace('"', "")}"`;
|
|
1264
|
+
});
|
|
1265
|
+
return `[WHERE ${where_clauses.join(" AND ")}]`;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
function $aa4450dcbeef3ac0$export$385a5aba38cc3325(sortArray) {
|
|
1270
|
+
let newQuery = [];
|
|
1271
|
+
sortArray.forEach((s)=>{
|
|
1272
|
+
return newQuery.push({
|
|
1273
|
+
property: s.id,
|
|
1274
|
+
order: s.desc ? "desc" : "asc"
|
|
1275
|
+
});
|
|
1276
|
+
});
|
|
1277
|
+
return newQuery;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
const $d98f94c79ddf4e0e$var$DataTable = ({ className: // data,
|
|
1286
|
+
// filterTitle,
|
|
1287
|
+
// columns,
|
|
1288
|
+
// totalRows,
|
|
1289
|
+
// limit,
|
|
1290
|
+
// loading,
|
|
1291
|
+
// options,
|
|
1292
|
+
// columnDefaults,
|
|
1293
|
+
// sortDefaults,
|
|
1294
|
+
// setSort,
|
|
1295
|
+
// setConditions,
|
|
1296
|
+
// conditionsTransform,
|
|
1297
|
+
// sortTransform,
|
|
1298
|
+
className })=>{
|
|
1299
|
+
// const { layout, columnFilter, columnSort, columnResize } = options;
|
|
1300
|
+
// const { minWidth, maxWidth, width } = columnDefaults;
|
|
1301
|
+
// const {
|
|
1302
|
+
// tableContainerClassName,
|
|
1303
|
+
// headerCellClassName,
|
|
1304
|
+
// headerGroupClassName,
|
|
1305
|
+
// defaultColumnFilterClassName,
|
|
1306
|
+
// cellClassName,
|
|
1307
|
+
// cellFirstRowClassName,
|
|
1308
|
+
// cellEvenRowClassName,
|
|
1309
|
+
// cellOddRowClassName,
|
|
1310
|
+
// tableColumnResizer,
|
|
1311
|
+
// tableColumnIsResizing,
|
|
1312
|
+
// headerCellTextClassName,
|
|
1313
|
+
// filterTitleClassName,
|
|
1314
|
+
// headerFilterClassName,
|
|
1315
|
+
// headerFilterCellClassName,
|
|
1316
|
+
// columnIsSortedClassName,
|
|
1317
|
+
// columnIsSortedAscClassName,
|
|
1318
|
+
// columnIsSortedDecClassName,
|
|
1319
|
+
// } = tableClasses;
|
|
1320
|
+
// if (columns.length === 0) {
|
|
1321
|
+
// return <p>Loading</p>;
|
|
1322
|
+
// }
|
|
1323
|
+
// const filterTypes = React.useMemo(
|
|
1324
|
+
// () => ({
|
|
1325
|
+
// // Add a new fuzzyTextFilterFn filter type.
|
|
1326
|
+
// // fuzzyText: fuzzyTextFilterFn,
|
|
1327
|
+
// // Or, override the default text filter to use
|
|
1328
|
+
// // "startWith"
|
|
1329
|
+
// text: (rows, id, filterValue) =>
|
|
1330
|
+
// rows.filter((row) => {
|
|
1331
|
+
// const rowValue = row.values[id];
|
|
1332
|
+
// return rowValue !== undefined
|
|
1333
|
+
// ? String(rowValue)
|
|
1334
|
+
// .toLowerCase()
|
|
1335
|
+
// .startsWith(String(filterValue).toLowerCase())
|
|
1336
|
+
// : true;
|
|
1337
|
+
// }),
|
|
1338
|
+
// }),
|
|
1339
|
+
// []
|
|
1340
|
+
// );
|
|
1341
|
+
// function DefaultColumnFilter({
|
|
1342
|
+
// column: { Header, accessor, setFilter, filterValue },
|
|
1343
|
+
// }) {
|
|
1344
|
+
// return (
|
|
1345
|
+
// <div>
|
|
1346
|
+
// <label
|
|
1347
|
+
// className={defaultColumnFilterClassName}
|
|
1348
|
+
// htmlFor={`filter_${accessor}`}
|
|
1349
|
+
// >
|
|
1350
|
+
// {`Filter ${Header}`}
|
|
1351
|
+
// </label>
|
|
1352
|
+
// <input
|
|
1353
|
+
// className="usa-input margin-bottom-1"
|
|
1354
|
+
// onChange={(e) => {
|
|
1355
|
+
// setFilter(e.target.value) || undefined;
|
|
1356
|
+
// }}
|
|
1357
|
+
// id={`filter_${accessor}`}
|
|
1358
|
+
// name={`filter_${accessor}`}
|
|
1359
|
+
// type="text"
|
|
1360
|
+
// value={filterValue || ""}
|
|
1361
|
+
// />
|
|
1362
|
+
// </div>
|
|
1363
|
+
// );
|
|
1364
|
+
// }
|
|
1365
|
+
// const defaultColumn = React.useMemo(
|
|
1366
|
+
// () => ({
|
|
1367
|
+
// // Let's set up our default Filter UI
|
|
1368
|
+
// Filter: customColumnFilter ? customColumnFilter : DefaultColumnFilter,
|
|
1369
|
+
// // When using the useFlexLayout:
|
|
1370
|
+
// minWidth: minWidth, // minWidth is only used as a limit for resizing
|
|
1371
|
+
// width: width, // width is used for both the flex-basis and flex-grow
|
|
1372
|
+
// maxWidth: maxWidth, // maxWidth is only used as a limit for resizing
|
|
1373
|
+
// }),
|
|
1374
|
+
// []
|
|
1375
|
+
// );
|
|
1376
|
+
// const {
|
|
1377
|
+
// getTableProps,
|
|
1378
|
+
// prepareRow,
|
|
1379
|
+
// rows,
|
|
1380
|
+
// headerGroups,
|
|
1381
|
+
// state: { filters, sortBy },
|
|
1382
|
+
// } = useReactTable(
|
|
1383
|
+
// {
|
|
1384
|
+
// columns,
|
|
1385
|
+
// data,
|
|
1386
|
+
// filterTypes,
|
|
1387
|
+
// initialState: {
|
|
1388
|
+
// sortBy: sortDefaults
|
|
1389
|
+
// },
|
|
1390
|
+
// manualPagination: true,
|
|
1391
|
+
// manualFilters: true,
|
|
1392
|
+
// manualSortBy: true,
|
|
1393
|
+
// pageCount: Math.ceil(totalRows / limit),
|
|
1394
|
+
// filterTypes,
|
|
1395
|
+
// defaultColumn,
|
|
1396
|
+
// },
|
|
1397
|
+
// // useResizeColumns,
|
|
1398
|
+
// // useFilters,
|
|
1399
|
+
// // useSortBy,
|
|
1400
|
+
// // usePagination,
|
|
1401
|
+
// // layout === "block" ? useBlockLayout : useFlexLayout
|
|
1402
|
+
// );
|
|
1403
|
+
// useEffect(() => {
|
|
1404
|
+
// if (columnSort) {
|
|
1405
|
+
// const normalizedSort = sortTransform ? sortTransform(sortBy) : filters;
|
|
1406
|
+
// setSort(normalizedSort);
|
|
1407
|
+
// }
|
|
1408
|
+
// }, [sortBy]);
|
|
1409
|
+
// useEffect(() => {
|
|
1410
|
+
// let timerFunc = setTimeout(() => {
|
|
1411
|
+
// if (columnFilter) {
|
|
1412
|
+
// const normalizedFilters = conditionsTransform
|
|
1413
|
+
// ? conditionsTransform(filters)
|
|
1414
|
+
// : filters;
|
|
1415
|
+
// setConditions(normalizedFilters);
|
|
1416
|
+
// }
|
|
1417
|
+
// }, 1000);
|
|
1418
|
+
// return () => clearTimeout(timerFunc);
|
|
1419
|
+
// }, [filters]);
|
|
1420
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1421
|
+
className: className,
|
|
1422
|
+
tabIndex: "0",
|
|
1423
|
+
children: "TABLE"
|
|
1424
|
+
});
|
|
1425
|
+
};
|
|
1426
|
+
var // DataTable.defaultProps = {
|
|
1427
|
+
// filterTitle: "",
|
|
1428
|
+
// className: "",
|
|
1429
|
+
// tableClasses: {
|
|
1430
|
+
// tableContainerClassName: "",
|
|
1431
|
+
// tableColumnResizer:
|
|
1432
|
+
// "width-1 bg-primary margin-right-neg-05 position-absolute top-0 bottom-0 right-0 z-100",
|
|
1433
|
+
// tableColumnIsResizing: "",
|
|
1434
|
+
// headerCellClassName:
|
|
1435
|
+
// "bg-base-lighter border-top-1px text-right text-bold padding-x-1 overflow-hidden",
|
|
1436
|
+
// headerGroupClassName: "",
|
|
1437
|
+
// headerCellTextClassName:
|
|
1438
|
+
// "overflow-hidden text-no-wrap display-inline-block",
|
|
1439
|
+
// defaultColumnFilterClassName: "usa-label usa-sr-only",
|
|
1440
|
+
// cellTextClassName: "overflow-hidden text-no-wrap display-inline-block",
|
|
1441
|
+
// cellFirstRowClassName: "",
|
|
1442
|
+
// cellClassName:
|
|
1443
|
+
// "border-right-1px font-mono-sm text-tabular text-right padding-x-105 padding-y-05",
|
|
1444
|
+
// cellEvenRowClassName: "bg-base-lightest",
|
|
1445
|
+
// cellOddRowClassName: "",
|
|
1446
|
+
// filterTitleClassName: "",
|
|
1447
|
+
// headerFilterCellClassName:
|
|
1448
|
+
// "bg-base-lighter border-bottom-1px border-right-1px padding-x-1",
|
|
1449
|
+
// headerFilterClassName: "",
|
|
1450
|
+
// columnIsSortedClassName: "",
|
|
1451
|
+
// columnIsSortedAscClassName: "",
|
|
1452
|
+
// columnIsSortedDecClassName: "",
|
|
1453
|
+
// },
|
|
1454
|
+
// options: {
|
|
1455
|
+
// layout: "flex",
|
|
1456
|
+
// columnFilter: true,
|
|
1457
|
+
// columnSort: true,
|
|
1458
|
+
// columnResize: true,
|
|
1459
|
+
// },
|
|
1460
|
+
// columnDefaults: {
|
|
1461
|
+
// minWidth: 30,
|
|
1462
|
+
// maxWidth: 300,
|
|
1463
|
+
// width: 150,
|
|
1464
|
+
// },
|
|
1465
|
+
// customColumnFilter: undefined,
|
|
1466
|
+
// sortDefaults: []
|
|
1467
|
+
// };
|
|
1468
|
+
// DataTable.propTypes = {
|
|
1469
|
+
// options: PropTypes.shape({
|
|
1470
|
+
// layout: PropTypes.oneOf(["flex", "block"]),
|
|
1471
|
+
// columnFilter: PropTypes.bool,
|
|
1472
|
+
// columnSort: PropTypes.bool,
|
|
1473
|
+
// columnResize: PropTypes.bool,
|
|
1474
|
+
// }),
|
|
1475
|
+
// sortDefaults: PropTypes.arrayOf(
|
|
1476
|
+
// PropTypes.shape({
|
|
1477
|
+
// id: PropTypes.string,
|
|
1478
|
+
// desc: PropTypes.bool,
|
|
1479
|
+
// })
|
|
1480
|
+
// ),
|
|
1481
|
+
// columns: PropTypes.arrayOf(
|
|
1482
|
+
// PropTypes.shape({
|
|
1483
|
+
// Header: PropTypes.string.isRequired,
|
|
1484
|
+
// accessor: PropTypes.string.isRequired,
|
|
1485
|
+
// })
|
|
1486
|
+
// ).isRequired,
|
|
1487
|
+
// setSort: PropTypes.func.isRequired,
|
|
1488
|
+
// setConditions: PropTypes.func.isRequired,
|
|
1489
|
+
// conditionsTransform: PropTypes.func,
|
|
1490
|
+
// sortTransform: PropTypes.func,
|
|
1491
|
+
// data: PropTypes.arrayOf(PropTypes.object),
|
|
1492
|
+
// className: PropTypes.string,
|
|
1493
|
+
// filterTitle: PropTypes.string,
|
|
1494
|
+
// totalRows: PropTypes.number.isRequired,
|
|
1495
|
+
// limit: PropTypes.number.isRequired,
|
|
1496
|
+
// loading: PropTypes.bool,
|
|
1497
|
+
// columnDefaults: PropTypes.shape({
|
|
1498
|
+
// minWidth: PropTypes.number,
|
|
1499
|
+
// maxWidth: PropTypes.number,
|
|
1500
|
+
// width: PropTypes.number,
|
|
1501
|
+
// }),
|
|
1502
|
+
// customColumnFilter: PropTypes.func,
|
|
1503
|
+
// // tableClasses,
|
|
1504
|
+
// // cellTextClassName
|
|
1505
|
+
// };
|
|
1506
|
+
$d98f94c79ddf4e0e$export$2e2bcd8739ae039 = $d98f94c79ddf4e0e$var$DataTable;
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
function $626282d9a03c51d5$var$calculateMaxWidth(previewSize) {
|
|
1512
|
+
return Math.floor(previewSize * 0.84);
|
|
1513
|
+
}
|
|
1514
|
+
function $626282d9a03c51d5$export$1147582dfae658c6(columns, schema) {
|
|
1515
|
+
return columns.map((column)=>({
|
|
1516
|
+
Header: schema && schema.fields[column].description ? schema.fields[column].description : column,
|
|
1517
|
+
accessor: column
|
|
1518
|
+
}));
|
|
1519
|
+
}
|
|
1520
|
+
function $626282d9a03c51d5$var$DefaultColumnFilter({ column: { Header: Header , accessor: accessor , setFilter: setFilter , filterValue: filterValue } }) {
|
|
1521
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
|
|
1522
|
+
label: `Filter by ${Header}`,
|
|
1523
|
+
onChange: (e)=>{
|
|
1524
|
+
setFilter(e.target.value) || undefined;
|
|
1525
|
+
},
|
|
1526
|
+
labelClassName: "ds-u-visibility--screen-reader",
|
|
1527
|
+
name: accessor,
|
|
1528
|
+
value: filterValue || ""
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding , id: id , options: options , resource: resource , defaultSort: defaultSort , customColumns: customColumns , truncateCellHeader: truncateCellHeader , columnSettings: columnSettings , columnWidths: columnWidths , customClasses: customClasses })=>{
|
|
1532
|
+
const previewContainer = (0, $hgUW1$react).useRef(null);
|
|
1533
|
+
const columnDefaults = {
|
|
1534
|
+
width: 200,
|
|
1535
|
+
maxWidth: previewContainer.current ? $626282d9a03c51d5$var$calculateMaxWidth(previewContainer.current.offsetWidth) : 300,
|
|
1536
|
+
minWidth: 100,
|
|
1537
|
+
...columnWidths
|
|
1538
|
+
};
|
|
1539
|
+
const tableClasses = {
|
|
1540
|
+
tableContainerClassName: "dc-c-table-container",
|
|
1541
|
+
headerCellClassName: "ds-u-border--dark ds-u-padding--2 ds-u-border-y--2 ds-u-font-weight--bold dc-c-table-header-cell",
|
|
1542
|
+
headerGroupClassName: "dc-c-table-header-group",
|
|
1543
|
+
headerCellTextClassName: `${truncateCellHeader ? "dc-truncate" : ""} ds-u-display--inline-block`,
|
|
1544
|
+
cellEvenRowClassName: "ds-u-fill--gray-lightest",
|
|
1545
|
+
cellClassName: `${tablePadding} dc-truncate ds-u-padding-x--1`,
|
|
1546
|
+
filterTitleClassName: "ds-u-font-weight--bold ds-u-padding-left--2 ds-u-fill--gray-lightest ds-u-display--block",
|
|
1547
|
+
headerFilterClassName: "ds-u-padding-top--1 ds-u-fill--gray-lightest",
|
|
1548
|
+
headerFilterCellClassName: "ds-u-padding-x--1 ds-u-padding-bottom--0 ds-u-border-bottom--0 ds-u-fill--gray-lightest",
|
|
1549
|
+
columnIsSortedClassName: "dc-c-sort dc-c-sort--default",
|
|
1550
|
+
columnIsSortedAscClassName: "dc-c-sort dc-c-sort--asc",
|
|
1551
|
+
columnIsSortedDecClassName: "dc-c-sort dc-c-sort--desc",
|
|
1552
|
+
tableColumnResizer: "dc-c-resize-handle",
|
|
1553
|
+
tableColumnIsResizing: "isResizing",
|
|
1554
|
+
...customClasses
|
|
1555
|
+
};
|
|
1556
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1557
|
+
ref: previewContainer,
|
|
1558
|
+
id: "resource-preview",
|
|
1559
|
+
className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
|
|
1560
|
+
children: previewContainer.current && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
|
|
1561
|
+
// filterTitle="Filter columns"
|
|
1562
|
+
// data={resource.values}
|
|
1563
|
+
// sortDefaults={defaultSort}
|
|
1564
|
+
// columns={
|
|
1565
|
+
// customColumns ? customColumns : prepareColumns(resource.columns, resource.schema[id])
|
|
1566
|
+
// }
|
|
1567
|
+
// schema={resource.schema}
|
|
1568
|
+
// totalRows={parseInt(resource.totalRows)}
|
|
1569
|
+
// limit={resource.limit}
|
|
1570
|
+
// offset={resource.offset}
|
|
1571
|
+
// loading={resource.loading}
|
|
1572
|
+
// setSort={resource.setSort}
|
|
1573
|
+
// setConditions={resource.setConditions}
|
|
1574
|
+
// conditionsTransform={transformTableFilterToQueryCondition}
|
|
1575
|
+
// sortTransform={transformTableSortToQuerySort}
|
|
1576
|
+
// tableClasses={tableClasses}
|
|
1577
|
+
className: "dc-c-datatable"
|
|
1578
|
+
})
|
|
1579
|
+
});
|
|
1580
|
+
};
|
|
1581
|
+
$626282d9a03c51d5$var$ResourcePreview.defaultProps = {
|
|
1582
|
+
options: {
|
|
1583
|
+
layout: "flex",
|
|
1584
|
+
columnFilter: false,
|
|
1585
|
+
columnSort: true,
|
|
1586
|
+
columnResize: true
|
|
1587
|
+
},
|
|
1588
|
+
truncateCellHeader: true,
|
|
1589
|
+
defaultSort: []
|
|
1590
|
+
};
|
|
1591
|
+
var $626282d9a03c51d5$export$2e2bcd8739ae039 = $626282d9a03c51d5$var$ResourcePreview;
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
|
|
1604
|
+
const $1e012d1e3b534af0$var$DataTableDensity = ({ setTablePadding: setTablePadding , tablePadding: tablePadding })=>{
|
|
1605
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1606
|
+
className: "ds-u-display--flex",
|
|
1607
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
1608
|
+
options: [
|
|
1609
|
+
{
|
|
1610
|
+
label: "Tight",
|
|
1611
|
+
value: "ds-u-padding-y--0"
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
label: "Normal",
|
|
1615
|
+
value: "ds-u-padding-y--1"
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
label: "Expanded",
|
|
1619
|
+
value: "ds-u-padding-y--2"
|
|
1620
|
+
}
|
|
1621
|
+
],
|
|
1622
|
+
size: "small",
|
|
1623
|
+
label: "Display density:",
|
|
1624
|
+
labelClassName: "ds-u-margin-top--0",
|
|
1625
|
+
name: "datatable_display_density",
|
|
1626
|
+
onChange: (e)=>setTablePadding(e.target.value),
|
|
1627
|
+
defaultValue: "ds-u-padding-y--1"
|
|
1628
|
+
})
|
|
1629
|
+
});
|
|
1630
|
+
};
|
|
1631
|
+
$1e012d1e3b534af0$var$DataTableDensity.propTypes = {
|
|
1632
|
+
setTablePadding: (0, $hgUW1$proptypes).func.isRequired
|
|
1633
|
+
};
|
|
1634
|
+
var $1e012d1e3b534af0$export$2e2bcd8739ae039 = $1e012d1e3b534af0$var$DataTableDensity;
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
const $e71aee394fdad8bd$var$ManageColumns = ()=>{
|
|
1641
|
+
const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
|
|
1642
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
1643
|
+
onClick: ()=>setModalOpen(!modalOpen),
|
|
1644
|
+
children: "Manage Columns"
|
|
1645
|
+
});
|
|
1646
|
+
};
|
|
1647
|
+
var $e71aee394fdad8bd$export$2e2bcd8739ae039 = $e71aee394fdad8bd$var$ManageColumns;
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
const $4def8e29c2039eb8$var$DataTableRowChanger = ({ setLimit: setLimit , rowOptions: rowOptions , limit: limit })=>{
|
|
1655
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1656
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
1657
|
+
options: rowOptions.map((row)=>({
|
|
1658
|
+
label: row,
|
|
1659
|
+
value: row
|
|
1660
|
+
})),
|
|
1661
|
+
size: "small",
|
|
1662
|
+
label: "Rows per page:",
|
|
1663
|
+
labelClassName: "ds-u-margin-top--0",
|
|
1664
|
+
name: "datatable_rows_per_page",
|
|
1665
|
+
onChange: (e)=>setLimit(e.target.value),
|
|
1666
|
+
defaultValue: limit
|
|
1667
|
+
})
|
|
1668
|
+
});
|
|
1669
|
+
};
|
|
1670
|
+
$4def8e29c2039eb8$var$DataTableRowChanger.defaultProps = {
|
|
1671
|
+
rowOptions: [
|
|
1672
|
+
10,
|
|
1673
|
+
25,
|
|
1674
|
+
50,
|
|
1675
|
+
100
|
|
1676
|
+
]
|
|
1677
|
+
};
|
|
1678
|
+
$4def8e29c2039eb8$var$DataTableRowChanger.propTypes = {
|
|
1679
|
+
rowOptions: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).number),
|
|
1680
|
+
setLimit: (0, $hgUW1$proptypes).func.isRequired
|
|
1681
|
+
};
|
|
1682
|
+
var $4def8e29c2039eb8$export$2e2bcd8739ae039 = $4def8e29c2039eb8$var$DataTableRowChanger;
|
|
1683
|
+
|
|
1684
|
+
|
|
1685
|
+
|
|
1686
|
+
|
|
1687
|
+
const $e973bc477cdc2dc7$var$DownloadIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
|
|
1688
|
+
width: "15px",
|
|
1689
|
+
height: "15px",
|
|
1690
|
+
viewBox: "0 0 384 512",
|
|
1691
|
+
version: "1.1",
|
|
1692
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1693
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
1694
|
+
children: [
|
|
1695
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("title", {
|
|
1696
|
+
children: "Download Icon"
|
|
1697
|
+
}),
|
|
1698
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("g", {
|
|
1699
|
+
stroke: "none",
|
|
1700
|
+
strokeWidth: "1",
|
|
1701
|
+
fill: "none",
|
|
1702
|
+
fillRule: "evenodd",
|
|
1703
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
1704
|
+
fill: "#112E51",
|
|
1705
|
+
fillRule: "nonzero",
|
|
1706
|
+
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"
|
|
1707
|
+
})
|
|
1708
|
+
})
|
|
1709
|
+
]
|
|
1710
|
+
});
|
|
1711
|
+
var $e973bc477cdc2dc7$export$2e2bcd8739ae039 = $e973bc477cdc2dc7$var$DownloadIcon;
|
|
1712
|
+
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
const $7ec5423a30aa3f61$var$CopyIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
|
|
1717
|
+
width: "15px",
|
|
1718
|
+
height: "15px",
|
|
1719
|
+
viewBox: "0 0 512 512",
|
|
1720
|
+
version: "1.1",
|
|
1721
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1722
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
1723
|
+
children: [
|
|
1724
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("title", {
|
|
1725
|
+
children: "Copy Icon"
|
|
1726
|
+
}),
|
|
1727
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("g", {
|
|
1728
|
+
stroke: "none",
|
|
1729
|
+
strokeWidth: "1",
|
|
1730
|
+
fill: "none",
|
|
1731
|
+
fillRule: "evenodd",
|
|
1732
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
1733
|
+
fill: "#112E51",
|
|
1734
|
+
fillRule: "nonzero",
|
|
1735
|
+
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"
|
|
1736
|
+
})
|
|
1737
|
+
})
|
|
1738
|
+
]
|
|
1739
|
+
});
|
|
1740
|
+
var $7ec5423a30aa3f61$export$2e2bcd8739ae039 = $7ec5423a30aa3f61$var$CopyIcon;
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
const $ec9e1550b0b034d0$var$SettingsIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("svg", {
|
|
1746
|
+
width: "15px",
|
|
1747
|
+
height: "15px",
|
|
1748
|
+
// viewBox="0 0 15 15"
|
|
1749
|
+
viewBox: "0 0 512 512",
|
|
1750
|
+
version: "1.1",
|
|
1751
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1752
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
1753
|
+
children: [
|
|
1754
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("title", {
|
|
1755
|
+
children: "Settings Icon"
|
|
1756
|
+
}),
|
|
1757
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("g", {
|
|
1758
|
+
stroke: "none",
|
|
1759
|
+
strokeWidth: "1",
|
|
1760
|
+
fill: "none",
|
|
1761
|
+
fillRule: "evenodd",
|
|
1762
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
1763
|
+
fill: "#112E51",
|
|
1764
|
+
fillRule: "nonzero",
|
|
1765
|
+
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"
|
|
1766
|
+
})
|
|
1767
|
+
})
|
|
1768
|
+
]
|
|
1769
|
+
});
|
|
1770
|
+
var $ec9e1550b0b034d0$export$2e2bcd8739ae039 = $ec9e1550b0b034d0$var$SettingsIcon;
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
const $af099c546cb226c7$var$ResourceHeader = ({ setTablePadding: setTablePadding , id: id , distribution: distribution , includeFiltered: includeFiltered , includeDensity: includeDensity , includeDownload: includeDownload , resource: resource , tablePadding: tablePadding , downloadUrl: downloadUrl })=>{
|
|
1774
|
+
const md = (0, $hgUW1$useMediaQuery)({
|
|
1775
|
+
minWidth: 0,
|
|
1776
|
+
maxWidth: 768
|
|
1777
|
+
});
|
|
1778
|
+
const { limit: limit , offset: offset , count: count , setLimit: setLimit , setOffset: setOffset } = resource;
|
|
1779
|
+
const intCount = count ? parseInt(count) : 0;
|
|
1780
|
+
const [referenceElement, setReferenceElement] = (0, $hgUW1$useState)(null);
|
|
1781
|
+
const [popperElement, setPopperElement] = (0, $hgUW1$useState)(null);
|
|
1782
|
+
const [arrowElement, setArrowElement] = (0, $hgUW1$useState)(null);
|
|
1783
|
+
const { styles: styles , attributes: attributes } = (0, $hgUW1$usePopper)(referenceElement, popperElement, {
|
|
1784
|
+
modifiers: [
|
|
1785
|
+
{
|
|
1786
|
+
name: "arrow",
|
|
1787
|
+
options: {
|
|
1788
|
+
element: arrowElement
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
]
|
|
1792
|
+
});
|
|
1793
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1794
|
+
className: "dc-c-resource-header",
|
|
1795
|
+
children: [
|
|
1796
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1797
|
+
className: "ds-l-row",
|
|
1798
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1799
|
+
className: "ds-l-col--12",
|
|
1800
|
+
children: includeFiltered && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
1801
|
+
className: "ds-c-button ds-c-button--primary",
|
|
1802
|
+
to: `/dataset/${id}/data`,
|
|
1803
|
+
children: "View and filter data"
|
|
1804
|
+
})
|
|
1805
|
+
})
|
|
1806
|
+
}),
|
|
1807
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1808
|
+
className: "ds-l-row ds-u-align-items--center",
|
|
1809
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1810
|
+
className: "ds-l-col--12 ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center",
|
|
1811
|
+
children: [
|
|
1812
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1813
|
+
className: "ds-u-font-weight--bold"
|
|
1814
|
+
}),
|
|
1815
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1816
|
+
className: "dc-c-resource-header--buttons",
|
|
1817
|
+
children: [
|
|
1818
|
+
includeDownload && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
1819
|
+
children: [
|
|
1820
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
|
|
1821
|
+
size: "small",
|
|
1822
|
+
className: "ds-u-text-align--left ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1",
|
|
1823
|
+
href: downloadUrl,
|
|
1824
|
+
"aria-label": "Download filtered data (CSV)",
|
|
1825
|
+
children: [
|
|
1826
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $e973bc477cdc2dc7$export$2e2bcd8739ae039), {}),
|
|
1827
|
+
!md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
1828
|
+
className: "ds-u-font-weight--semibold ds-u-margin-left--1",
|
|
1829
|
+
children: "Download filtered data (CSV)"
|
|
1830
|
+
})
|
|
1831
|
+
]
|
|
1832
|
+
}),
|
|
1833
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
|
|
1834
|
+
onOpen: ()=>{
|
|
1835
|
+
navigator.clipboard.writeText(window.location.href);
|
|
1836
|
+
},
|
|
1837
|
+
className: "ds-c-button ds-c-button--small ds-u-text-align--left ds-u-margin-right--1",
|
|
1838
|
+
placement: "bottom",
|
|
1839
|
+
dialog: true,
|
|
1840
|
+
ariaLabel: "Copy link to filtered data",
|
|
1841
|
+
title: "Link copied to clipboard",
|
|
1842
|
+
children: [
|
|
1843
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $7ec5423a30aa3f61$export$2e2bcd8739ae039), {}),
|
|
1844
|
+
!md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
1845
|
+
className: "ds-u-font-weight--semibold ds-u-margin-left--1",
|
|
1846
|
+
children: "Copy link to filtered data"
|
|
1847
|
+
})
|
|
1848
|
+
]
|
|
1849
|
+
})
|
|
1850
|
+
]
|
|
1851
|
+
}),
|
|
1852
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
|
|
1853
|
+
className: "ds-c-button ds-c-button--small ds-u-text-align--left",
|
|
1854
|
+
placement: "bottom",
|
|
1855
|
+
dialog: true,
|
|
1856
|
+
ariaLabel: "Display settings",
|
|
1857
|
+
title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1858
|
+
className: "dc-c-display-settings",
|
|
1859
|
+
children: [
|
|
1860
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $4def8e29c2039eb8$export$2e2bcd8739ae039), {
|
|
1861
|
+
limit: limit,
|
|
1862
|
+
setLimit: setLimit,
|
|
1863
|
+
setOffset: setOffset
|
|
1864
|
+
}),
|
|
1865
|
+
includeDensity && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $1e012d1e3b534af0$export$2e2bcd8739ae039), {
|
|
1866
|
+
setTablePadding: setTablePadding,
|
|
1867
|
+
tablePadding: tablePadding
|
|
1868
|
+
})
|
|
1869
|
+
]
|
|
1870
|
+
}),
|
|
1871
|
+
children: [
|
|
1872
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $ec9e1550b0b034d0$export$2e2bcd8739ae039), {}),
|
|
1873
|
+
!md && /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
1874
|
+
className: "ds-u-font-weight--semibold ds-u-margin-left--1",
|
|
1875
|
+
children: "Display settings"
|
|
1876
|
+
})
|
|
1877
|
+
]
|
|
1878
|
+
})
|
|
1879
|
+
]
|
|
1880
|
+
})
|
|
1881
|
+
]
|
|
1882
|
+
})
|
|
1883
|
+
})
|
|
1884
|
+
]
|
|
1885
|
+
});
|
|
1886
|
+
};
|
|
1887
|
+
var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHeader;
|
|
1888
|
+
|
|
1889
|
+
|
|
1890
|
+
|
|
1891
|
+
|
|
1892
|
+
|
|
1893
|
+
|
|
1894
|
+
const $17193a17e26a72da$var$DatasetTags = ({ keywords: keywords })=>{
|
|
1895
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1896
|
+
className: "dc-c-dataset-tags ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
|
|
1897
|
+
children: [
|
|
1898
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
1899
|
+
className: "ds-u-color--primary ds-u-font-size--h3 ds-u-margin-top--0 ds-u-margin-bottom--2",
|
|
1900
|
+
children: "Tags"
|
|
1901
|
+
}),
|
|
1902
|
+
keywords && keywords.map((k)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
1903
|
+
to: `/datasets?keyword[]=${k.data}`,
|
|
1904
|
+
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",
|
|
1905
|
+
children: k.data
|
|
1906
|
+
}, k.identifier))
|
|
1907
|
+
]
|
|
1908
|
+
});
|
|
1909
|
+
};
|
|
1910
|
+
$17193a17e26a72da$var$DatasetTags.propTypes = {
|
|
1911
|
+
keywords: (0, $hgUW1$proptypes).arrayOf((0, $hgUW1$proptypes).shape({
|
|
1912
|
+
data: (0, $hgUW1$proptypes).string.isRequired,
|
|
1913
|
+
identifier: (0, $hgUW1$proptypes).string.isRequired
|
|
1914
|
+
})).isRequired
|
|
1915
|
+
};
|
|
1916
|
+
var $17193a17e26a72da$export$2e2bcd8739ae039 = $17193a17e26a72da$var$DatasetTags;
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
const $f341c2fd9bc53390$var$DatasetDownloads = ({ downloadURL: downloadURL , type: type })=>{
|
|
1923
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1924
|
+
className: "ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
|
|
1925
|
+
children: [
|
|
1926
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
1927
|
+
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",
|
|
1928
|
+
children: "Downloads"
|
|
1929
|
+
}),
|
|
1930
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
1931
|
+
className: "ds-u-margin-bottom--1 ds-u-color--gray",
|
|
1932
|
+
children: "Resource"
|
|
1933
|
+
}),
|
|
1934
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
|
|
1935
|
+
href: downloadURL,
|
|
1936
|
+
className: "ds-u-word-break",
|
|
1937
|
+
children: [
|
|
1938
|
+
"Download this resource (",
|
|
1939
|
+
type,
|
|
1940
|
+
")"
|
|
1941
|
+
]
|
|
1942
|
+
})
|
|
1943
|
+
]
|
|
1944
|
+
});
|
|
1945
|
+
};
|
|
1946
|
+
$f341c2fd9bc53390$var$DatasetDownloads.propTypes = {
|
|
1947
|
+
downloadURL: (0, $hgUW1$proptypes).string.isRequired,
|
|
1948
|
+
type: (0, $hgUW1$proptypes).string.isRequired
|
|
1949
|
+
};
|
|
1950
|
+
var $f341c2fd9bc53390$export$2e2bcd8739ae039 = $f341c2fd9bc53390$var$DatasetDownloads;
|
|
1951
|
+
|
|
1952
|
+
|
|
1953
|
+
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
function $5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo) {
|
|
1957
|
+
const rows = [];
|
|
1958
|
+
Object.keys(metadataMapping).forEach((d)=>{
|
|
1959
|
+
if (!datasetInfo[d]) return null;
|
|
1960
|
+
else rows.push(...metadataMapping[d](datasetInfo[d]));
|
|
1961
|
+
});
|
|
1962
|
+
return rows;
|
|
1963
|
+
}
|
|
1964
|
+
const $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation = ({ datasetInfo: datasetInfo , id: id , metadataMapping: metadataMapping })=>{
|
|
1965
|
+
const [rows] = (0, $hgUW1$useState)($5644ebd2c3dbfd7b$export$eea3a12df15499ca(metadataMapping, datasetInfo));
|
|
1966
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1967
|
+
className: "dc-c-additional-info-table ds-u-margin-bottom--6",
|
|
1968
|
+
children: [
|
|
1969
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
1970
|
+
children: "Additional Information"
|
|
1971
|
+
}),
|
|
1972
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
|
|
1973
|
+
compact: true,
|
|
1974
|
+
striped: true,
|
|
1975
|
+
children: [
|
|
1976
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
|
|
1977
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
|
|
1978
|
+
children: [
|
|
1979
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
1980
|
+
children: "Field"
|
|
1981
|
+
}),
|
|
1982
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
1983
|
+
children: "Value"
|
|
1984
|
+
})
|
|
1985
|
+
]
|
|
1986
|
+
})
|
|
1987
|
+
}),
|
|
1988
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
|
|
1989
|
+
children: rows.map((r)=>/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
|
|
1990
|
+
children: [
|
|
1991
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
1992
|
+
children: r.label
|
|
1993
|
+
}),
|
|
1994
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
1995
|
+
children: r.value
|
|
1996
|
+
})
|
|
1997
|
+
]
|
|
1998
|
+
}, `${r.label}_${id}`))
|
|
1999
|
+
})
|
|
2000
|
+
]
|
|
2001
|
+
})
|
|
2002
|
+
]
|
|
2003
|
+
});
|
|
2004
|
+
};
|
|
2005
|
+
var $5644ebd2c3dbfd7b$export$2e2bcd8739ae039 = $5644ebd2c3dbfd7b$var$DatasetAdditionalInformation;
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
|
|
2009
|
+
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
const $69f3b3317f17a737$var$Pagination = ({ totalPages: totalPages , currentPage: currentPage , buttonAction: buttonAction })=>{
|
|
2015
|
+
const maxLength = 7;
|
|
2016
|
+
// Expectation starts at 1
|
|
2017
|
+
// only shows 7 buttons plus prev/next
|
|
2018
|
+
function addFirst() {
|
|
2019
|
+
// extra + 1 is number of siblings
|
|
2020
|
+
if (currentPage > 2) return [
|
|
2021
|
+
{
|
|
2022
|
+
id: 1,
|
|
2023
|
+
text: 1
|
|
2024
|
+
}
|
|
2025
|
+
];
|
|
2026
|
+
else return [];
|
|
2027
|
+
}
|
|
2028
|
+
function addLast() {
|
|
2029
|
+
// extra + 1 is number of siblings
|
|
2030
|
+
if (currentPage < totalPages) return [
|
|
2031
|
+
{
|
|
2032
|
+
id: totalPages,
|
|
2033
|
+
text: totalPages
|
|
2034
|
+
}
|
|
2035
|
+
];
|
|
2036
|
+
else return [];
|
|
2037
|
+
}
|
|
2038
|
+
function addPrev() {
|
|
2039
|
+
if (currentPage > 1) return [
|
|
2040
|
+
{
|
|
2041
|
+
id: "previous",
|
|
2042
|
+
text: "Previous"
|
|
2043
|
+
}
|
|
2044
|
+
];
|
|
2045
|
+
return [
|
|
2046
|
+
{
|
|
2047
|
+
id: "previous",
|
|
2048
|
+
text: "Previous",
|
|
2049
|
+
disabled: true
|
|
2050
|
+
}
|
|
2051
|
+
];
|
|
2052
|
+
}
|
|
2053
|
+
function addNext() {
|
|
2054
|
+
if (currentPage < totalPages) return [
|
|
2055
|
+
{
|
|
2056
|
+
id: "next",
|
|
2057
|
+
text: "Next"
|
|
2058
|
+
}
|
|
2059
|
+
];
|
|
2060
|
+
return [
|
|
2061
|
+
{
|
|
2062
|
+
id: "next",
|
|
2063
|
+
text: "Next",
|
|
2064
|
+
disabled: true
|
|
2065
|
+
}
|
|
2066
|
+
];
|
|
2067
|
+
}
|
|
2068
|
+
function buildSiblings() {
|
|
2069
|
+
// add check if current page less than totalPages
|
|
2070
|
+
let siblings = [
|
|
2071
|
+
{
|
|
2072
|
+
id: currentPage,
|
|
2073
|
+
text: currentPage,
|
|
2074
|
+
currentPage: true
|
|
2075
|
+
}
|
|
2076
|
+
];
|
|
2077
|
+
if (currentPage > 1) siblings.unshift({
|
|
2078
|
+
id: currentPage - 1,
|
|
2079
|
+
text: currentPage - 1
|
|
2080
|
+
});
|
|
2081
|
+
if (currentPage < totalPages - 1) siblings.push({
|
|
2082
|
+
id: currentPage + 1,
|
|
2083
|
+
text: currentPage + 1
|
|
2084
|
+
});
|
|
2085
|
+
return siblings;
|
|
2086
|
+
}
|
|
2087
|
+
function buildPreSiblings() {
|
|
2088
|
+
let preSiblings = [];
|
|
2089
|
+
let remainingSpots = 0;
|
|
2090
|
+
if (currentPage === 4) {
|
|
2091
|
+
remainingSpots = 1;
|
|
2092
|
+
preSiblings.push({
|
|
2093
|
+
id: "2",
|
|
2094
|
+
text: 2
|
|
2095
|
+
});
|
|
2096
|
+
}
|
|
2097
|
+
if (currentPage > 4) {
|
|
2098
|
+
remainingSpots = 1;
|
|
2099
|
+
preSiblings.push({
|
|
2100
|
+
id: "predots",
|
|
2101
|
+
text: "..."
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
if (currentPage > 4 && currentPage >= totalPages - 2) {
|
|
2105
|
+
remainingSpots = 1;
|
|
2106
|
+
preSiblings.push({
|
|
2107
|
+
id: totalPages - 4,
|
|
2108
|
+
text: totalPages - 4
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
if (currentPage > 4 && currentPage >= totalPages - 1) {
|
|
2112
|
+
remainingSpots = 1;
|
|
2113
|
+
preSiblings.push({
|
|
2114
|
+
id: totalPages - 3,
|
|
2115
|
+
text: totalPages - 3
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
if (currentPage > 4 && currentPage === totalPages) {
|
|
2119
|
+
remainingSpots = 1;
|
|
2120
|
+
preSiblings.push({
|
|
2121
|
+
id: totalPages - 2,
|
|
2122
|
+
text: totalPages - 2
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
return preSiblings;
|
|
2126
|
+
}
|
|
2127
|
+
function buildPostSiblings() {
|
|
2128
|
+
let postSiblings = [];
|
|
2129
|
+
let remainingSpots = maxLength - (currentPage + 1) - 1;
|
|
2130
|
+
if (currentPage < 5) {
|
|
2131
|
+
for(let spot = 1; spot < remainingSpots; spot++)// console.log('post-spot', spot)
|
|
2132
|
+
postSiblings.push({
|
|
2133
|
+
id: currentPage + 1 + spot,
|
|
2134
|
+
text: currentPage + 1 + spot
|
|
2135
|
+
});
|
|
2136
|
+
postSiblings.push({
|
|
2137
|
+
id: "postdots",
|
|
2138
|
+
text: "..."
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
if (currentPage >= 5 && currentPage < totalPages - 3) postSiblings.push({
|
|
2142
|
+
id: "postdots",
|
|
2143
|
+
text: "..."
|
|
2144
|
+
});
|
|
2145
|
+
if (currentPage >= 5 && currentPage === totalPages - 3) postSiblings.push({
|
|
2146
|
+
id: totalPages - 1,
|
|
2147
|
+
text: totalPages - 1
|
|
2148
|
+
});
|
|
2149
|
+
return postSiblings;
|
|
2150
|
+
}
|
|
2151
|
+
function buttonValue(item) {
|
|
2152
|
+
if (item === "Previous") return currentPage - 1;
|
|
2153
|
+
if (item === "Next") return currentPage + 1;
|
|
2154
|
+
return item;
|
|
2155
|
+
}
|
|
2156
|
+
function addAll() {
|
|
2157
|
+
let items = [
|
|
2158
|
+
...Array(totalPages)
|
|
2159
|
+
];
|
|
2160
|
+
return items.map((item, index)=>({
|
|
2161
|
+
id: index + 1,
|
|
2162
|
+
text: index + 1
|
|
2163
|
+
}));
|
|
2164
|
+
}
|
|
2165
|
+
function buildAll() {
|
|
2166
|
+
if (totalPages > 0 && totalPages <= maxLength) return [
|
|
2167
|
+
...addPrev(),
|
|
2168
|
+
...addAll(),
|
|
2169
|
+
...addNext()
|
|
2170
|
+
];
|
|
2171
|
+
if (totalPages > 0 && totalPages > maxLength) return [
|
|
2172
|
+
...addPrev(),
|
|
2173
|
+
...addFirst(),
|
|
2174
|
+
...buildPreSiblings(),
|
|
2175
|
+
...buildSiblings(),
|
|
2176
|
+
...buildPostSiblings(),
|
|
2177
|
+
...addLast(),
|
|
2178
|
+
...addNext()
|
|
2179
|
+
];
|
|
2180
|
+
return [];
|
|
2181
|
+
}
|
|
2182
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2183
|
+
className: "dc-pagination",
|
|
2184
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("nav", {
|
|
2185
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("ol", {
|
|
2186
|
+
className: "ds-u-display--flex ds-u-flex-direction--row ds-u-padding-x--0",
|
|
2187
|
+
children: buildAll().map((item)=>{
|
|
2188
|
+
let buttonClass = "";
|
|
2189
|
+
let liClass = "";
|
|
2190
|
+
if (item.text === "Previous") {
|
|
2191
|
+
buttonClass = "dc-pagination--previous__button";
|
|
2192
|
+
liClass = "dc-pagination--previous";
|
|
2193
|
+
}
|
|
2194
|
+
if (item.text === "Next") {
|
|
2195
|
+
buttonClass = "dc-pagination--next__button";
|
|
2196
|
+
liClass = "dc-pagination--next";
|
|
2197
|
+
}
|
|
2198
|
+
if (item.currentPage || item.text === currentPage) buttonClass = "dc-pagination-current__button";
|
|
2199
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
2200
|
+
className: liClass,
|
|
2201
|
+
children: item.id === "postdots" || item.id === "predots" ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2202
|
+
children: item.text
|
|
2203
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2204
|
+
className: buttonClass,
|
|
2205
|
+
disabled: item.disabled ? item.disabled : false,
|
|
2206
|
+
size: "small",
|
|
2207
|
+
variation: "transparent",
|
|
2208
|
+
onClick: ()=>buttonAction(buttonValue(item.text)),
|
|
2209
|
+
children: item.text
|
|
2210
|
+
})
|
|
2211
|
+
}, item.id);
|
|
2212
|
+
})
|
|
2213
|
+
})
|
|
2214
|
+
})
|
|
2215
|
+
});
|
|
2216
|
+
};
|
|
2217
|
+
var $69f3b3317f17a737$export$2e2bcd8739ae039 = $69f3b3317f17a737$var$Pagination;
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
const $072291d44ce1834a$var$ResourceFooter = ({ resource: resource })=>{
|
|
2221
|
+
const { limit: limit , values: values , offset: offset , count: count , setOffset: setOffset } = resource;
|
|
2222
|
+
function calcPageByOffset(page) {
|
|
2223
|
+
setOffset((page - 1) * limit);
|
|
2224
|
+
}
|
|
2225
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2226
|
+
children: values.length > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $69f3b3317f17a737$export$2e2bcd8739ae039), {
|
|
2227
|
+
totalPages: Math.ceil(Number(count) / limit),
|
|
2228
|
+
currentPage: Number(offset) / limit + 1,
|
|
2229
|
+
buttonAction: calcPageByOffset
|
|
2230
|
+
})
|
|
2231
|
+
});
|
|
2232
|
+
};
|
|
2233
|
+
var $072291d44ce1834a$export$2e2bcd8739ae039 = $072291d44ce1834a$var$ResourceFooter;
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
const $68eacd619bee0da7$var$ResourceInformation = ({ resource: resource })=>{
|
|
2240
|
+
const { count: count , columns: columns } = resource;
|
|
2241
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2242
|
+
className: "dc-c-resource-info-table",
|
|
2243
|
+
children: [
|
|
2244
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
2245
|
+
children: "About this Resource"
|
|
2246
|
+
}),
|
|
2247
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
|
|
2248
|
+
compact: true,
|
|
2249
|
+
striped: true,
|
|
2250
|
+
children: [
|
|
2251
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
|
|
2252
|
+
children: [
|
|
2253
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
2254
|
+
component: "th",
|
|
2255
|
+
scope: "row",
|
|
2256
|
+
children: "Rows"
|
|
2257
|
+
}),
|
|
2258
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
2259
|
+
align: "right",
|
|
2260
|
+
children: parseInt(count).toLocaleString()
|
|
2261
|
+
})
|
|
2262
|
+
]
|
|
2263
|
+
}),
|
|
2264
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableRow), {
|
|
2265
|
+
children: [
|
|
2266
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
2267
|
+
component: "th",
|
|
2268
|
+
scope: "row",
|
|
2269
|
+
children: "Columns"
|
|
2270
|
+
}),
|
|
2271
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
2272
|
+
align: "right",
|
|
2273
|
+
children: columns.length.toLocaleString()
|
|
2274
|
+
})
|
|
2275
|
+
]
|
|
2276
|
+
})
|
|
2277
|
+
]
|
|
2278
|
+
})
|
|
2279
|
+
]
|
|
2280
|
+
});
|
|
2281
|
+
};
|
|
2282
|
+
var $68eacd619bee0da7$export$2e2bcd8739ae039 = $68eacd619bee0da7$var$ResourceInformation;
|
|
2283
|
+
|
|
2284
|
+
|
|
2285
|
+
// Example custom column headers, where only effective date has an ! at the end
|
|
2286
|
+
// [
|
|
2287
|
+
// {schema: 'date', Cell: ({ value }) => localeDate(value),},
|
|
2288
|
+
// {accessor: 'effective_date',Cell: ({ value }) => localeDate(value) + '!',},
|
|
2289
|
+
// ]
|
|
2290
|
+
function $7264a673914aa746$export$8049e8f40a9bdfb8(customHeaders, columns, schema) {
|
|
2291
|
+
return columns.map((column)=>{
|
|
2292
|
+
const customAccessorIndex = customHeaders.findIndex((header)=>header.accessor === column);
|
|
2293
|
+
const customSchemaIndex = customHeaders.findIndex((header)=>header.schema === schema.fields[column].mysql_type);
|
|
2294
|
+
let newColumn = {};
|
|
2295
|
+
// If specific accessor is passed, this will override a general mysql_type Cell rewrite.
|
|
2296
|
+
if (customAccessorIndex > -1) {
|
|
2297
|
+
newColumn.Header = schema && schema.fields[column].description ? schema.fields[column].description : column;
|
|
2298
|
+
newColumn.accessor = column;
|
|
2299
|
+
newColumn.Cell = customHeaders[customAccessorIndex].Cell;
|
|
2300
|
+
} else {
|
|
2301
|
+
newColumn.Header = schema && schema.fields[column].description ? schema.fields[column].description : column;
|
|
2302
|
+
newColumn.accessor = column;
|
|
2303
|
+
if (customSchemaIndex > -1) newColumn.Cell = customHeaders[customSchemaIndex].Cell;
|
|
2304
|
+
}
|
|
2305
|
+
return newColumn;
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
function $7264a673914aa746$export$e284ae5d89467c8f(date) {
|
|
2309
|
+
if (!date) return date;
|
|
2310
|
+
date = new Date(date);
|
|
2311
|
+
date = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
2312
|
+
return date;
|
|
2313
|
+
}
|
|
2314
|
+
function $7264a673914aa746$export$6b5e57d20078142b(value, operator) {
|
|
2315
|
+
let newValue = value;
|
|
2316
|
+
if (Array.isArray(newValue)) newValue = newValue.join(",");
|
|
2317
|
+
// return newValue.replace(/(^\%+|\%+$)/gm, '');
|
|
2318
|
+
return newValue;
|
|
2319
|
+
}
|
|
2320
|
+
const $7264a673914aa746$export$5f89a5ae87bc48e1 = [
|
|
2321
|
+
{
|
|
2322
|
+
label: "Is",
|
|
2323
|
+
value: "="
|
|
2324
|
+
},
|
|
2325
|
+
{
|
|
2326
|
+
label: "Starts With",
|
|
2327
|
+
value: "starts with"
|
|
2328
|
+
},
|
|
2329
|
+
{
|
|
2330
|
+
label: "Contains",
|
|
2331
|
+
value: "contains"
|
|
2332
|
+
},
|
|
2333
|
+
{
|
|
2334
|
+
label: "Is Not",
|
|
2335
|
+
value: "<>"
|
|
2336
|
+
},
|
|
2337
|
+
{
|
|
2338
|
+
label: "Or",
|
|
2339
|
+
value: "in"
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
label: "Is",
|
|
2343
|
+
value: "="
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
label: "Is Not",
|
|
2347
|
+
value: "<>"
|
|
2348
|
+
},
|
|
2349
|
+
{
|
|
2350
|
+
label: "Greater Than",
|
|
2351
|
+
value: ">"
|
|
2352
|
+
},
|
|
2353
|
+
{
|
|
2354
|
+
label: "Less Than",
|
|
2355
|
+
value: "<"
|
|
2356
|
+
}
|
|
2357
|
+
];
|
|
2358
|
+
function $7264a673914aa746$export$2b9377795161999(type) {
|
|
2359
|
+
switch(type){
|
|
2360
|
+
case "text":
|
|
2361
|
+
case "string":
|
|
2362
|
+
return [
|
|
2363
|
+
{
|
|
2364
|
+
label: "Is",
|
|
2365
|
+
value: "="
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
label: "Starts With",
|
|
2369
|
+
value: "starts with"
|
|
2370
|
+
},
|
|
2371
|
+
{
|
|
2372
|
+
label: "Contains",
|
|
2373
|
+
value: "contains"
|
|
2374
|
+
},
|
|
2375
|
+
{
|
|
2376
|
+
label: "Is Not",
|
|
2377
|
+
value: "<>"
|
|
2378
|
+
},
|
|
2379
|
+
{
|
|
2380
|
+
label: "Or",
|
|
2381
|
+
value: "in"
|
|
2382
|
+
}
|
|
2383
|
+
];
|
|
2384
|
+
case "date":
|
|
2385
|
+
return [
|
|
2386
|
+
{
|
|
2387
|
+
label: "Is",
|
|
2388
|
+
value: "="
|
|
2389
|
+
},
|
|
2390
|
+
{
|
|
2391
|
+
label: "Is Not",
|
|
2392
|
+
value: "<>"
|
|
2393
|
+
},
|
|
2394
|
+
{
|
|
2395
|
+
label: "Greater Than",
|
|
2396
|
+
value: ">"
|
|
2397
|
+
},
|
|
2398
|
+
{
|
|
2399
|
+
label: "Less Than",
|
|
2400
|
+
value: "<"
|
|
2401
|
+
}
|
|
2402
|
+
];
|
|
2403
|
+
default:
|
|
2404
|
+
// These 2 should be safe for all data types
|
|
2405
|
+
return [
|
|
2406
|
+
{
|
|
2407
|
+
label: "Is",
|
|
2408
|
+
value: "="
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
label: "Is Not",
|
|
2412
|
+
value: "<>"
|
|
2413
|
+
}
|
|
2414
|
+
];
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
|
|
2419
|
+
const $766b8e351dd607f5$var$DatasetBody = ({ rootUrl: rootUrl , id: id , dataset: dataset , additionalParams: additionalParams , customColumns: customColumns , columnSettings: columnSettings , columnWidths: columnWidths , metadataMapping: metadataMapping })=>{
|
|
2420
|
+
let apiDocs = (0, $hgUW1$useRef)();
|
|
2421
|
+
const [tablePadding, setTablePadding] = (0, $hgUW1$useState)("ds-u-padding-y--1");
|
|
2422
|
+
const [fileFormat, setFileFormat] = (0, $hgUW1$useState)("");
|
|
2423
|
+
let distribution = {};
|
|
2424
|
+
let distribution_array = dataset.distribution ? dataset.distribution : [];
|
|
2425
|
+
if (distribution_array.length) distribution = distribution_array[0];
|
|
2426
|
+
const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
|
|
2427
|
+
limit: 10,
|
|
2428
|
+
manual: true
|
|
2429
|
+
}, additionalParams);
|
|
2430
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
2431
|
+
if (distribution.identifier) {
|
|
2432
|
+
let localFileFormat = "";
|
|
2433
|
+
if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
|
|
2434
|
+
else if (distribution.data.mediaType) {
|
|
2435
|
+
const mediaType = distribution.data.mediaType.split("/");
|
|
2436
|
+
if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
|
|
2437
|
+
}
|
|
2438
|
+
setFileFormat(localFileFormat);
|
|
2439
|
+
if (localFileFormat === "CSV") {
|
|
2440
|
+
resource.setResource(distribution.identifier);
|
|
2441
|
+
resource.setManual(false);
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
}, [
|
|
2445
|
+
distribution
|
|
2446
|
+
]);
|
|
2447
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
|
|
2448
|
+
className: "ds-l-container",
|
|
2449
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2450
|
+
className: "ds-l-row ds-u-padding-top--3",
|
|
2451
|
+
children: [
|
|
2452
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2453
|
+
className: "ds-l-md-col--9 ds-l-sm-col--12",
|
|
2454
|
+
children: [
|
|
2455
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
|
|
2456
|
+
className: "ds-title ds-u-word-break",
|
|
2457
|
+
children: dataset.title
|
|
2458
|
+
}),
|
|
2459
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2460
|
+
className: "ds-l-row",
|
|
2461
|
+
children: [
|
|
2462
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
2463
|
+
className: "ds-l-col--6",
|
|
2464
|
+
children: dataset.theme ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
2465
|
+
variation: "info",
|
|
2466
|
+
children: dataset.theme[0].data
|
|
2467
|
+
}) : null
|
|
2468
|
+
}),
|
|
2469
|
+
dataset.modified && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
|
|
2470
|
+
className: "ds-l-col--6 ds-u-color--gray ds-u-text-align--right",
|
|
2471
|
+
children: [
|
|
2472
|
+
"Updated ",
|
|
2473
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
|
|
2474
|
+
date: dataset.modified
|
|
2475
|
+
})
|
|
2476
|
+
]
|
|
2477
|
+
})
|
|
2478
|
+
]
|
|
2479
|
+
}),
|
|
2480
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
2481
|
+
className: "dc-c-metadata-description",
|
|
2482
|
+
dangerouslySetInnerHTML: {
|
|
2483
|
+
__html: dataset.description
|
|
2484
|
+
}
|
|
2485
|
+
}),
|
|
2486
|
+
resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
2487
|
+
children: [
|
|
2488
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
2489
|
+
className: "dc-resource-header",
|
|
2490
|
+
children: "Resource Preview"
|
|
2491
|
+
}),
|
|
2492
|
+
resource.columns ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2493
|
+
children: [
|
|
2494
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $af099c546cb226c7$export$2e2bcd8739ae039), {
|
|
2495
|
+
id: id,
|
|
2496
|
+
includeFiltered: true,
|
|
2497
|
+
includeDensity: true,
|
|
2498
|
+
tablePadding: tablePadding,
|
|
2499
|
+
setTablePadding: setTablePadding,
|
|
2500
|
+
distribution: distribution,
|
|
2501
|
+
resource: resource
|
|
2502
|
+
}),
|
|
2503
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $626282d9a03c51d5$export$2e2bcd8739ae039), {
|
|
2504
|
+
id: distribution.identifier,
|
|
2505
|
+
tablePadding: tablePadding,
|
|
2506
|
+
resource: resource,
|
|
2507
|
+
customColumns: (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution_array[0].identifier]),
|
|
2508
|
+
columnSettings: columnSettings,
|
|
2509
|
+
options: {
|
|
2510
|
+
layout: "flex",
|
|
2511
|
+
columnFilter: false,
|
|
2512
|
+
columnSort: true,
|
|
2513
|
+
columnResize: true
|
|
2514
|
+
},
|
|
2515
|
+
columnWidths: columnWidths
|
|
2516
|
+
}),
|
|
2517
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $072291d44ce1834a$export$2e2bcd8739ae039), {
|
|
2518
|
+
resource: resource
|
|
2519
|
+
}),
|
|
2520
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $68eacd619bee0da7$export$2e2bcd8739ae039), {
|
|
2521
|
+
resource: resource
|
|
2522
|
+
})
|
|
2523
|
+
]
|
|
2524
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)(Spinner, {
|
|
2525
|
+
"aria-valuetext": "Dataset loading",
|
|
2526
|
+
role: "status"
|
|
2527
|
+
})
|
|
2528
|
+
]
|
|
2529
|
+
}) : "",
|
|
2530
|
+
dataset.identifier && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5644ebd2c3dbfd7b$export$2e2bcd8739ae039), {
|
|
2531
|
+
datasetInfo: dataset,
|
|
2532
|
+
id: dataset.identifier,
|
|
2533
|
+
metadataMapping: metadataMapping
|
|
2534
|
+
}),
|
|
2535
|
+
Object.keys(distribution).length && fileFormat === "CSV" && dataset.identifier ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2536
|
+
ref: apiDocs,
|
|
2537
|
+
children: [
|
|
2538
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
2539
|
+
children: "Try the API"
|
|
2540
|
+
}),
|
|
2541
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
|
|
2542
|
+
url: `${undefined}/metastore/schemas/dataset/items/${dataset.identifier}/docs${additionalParams && additionalParams.ACA ? "?ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
|
|
2543
|
+
docExpansion: "list",
|
|
2544
|
+
defaultModelsExpandDepth: -1
|
|
2545
|
+
})
|
|
2546
|
+
]
|
|
2547
|
+
}) : ""
|
|
2548
|
+
]
|
|
2549
|
+
}),
|
|
2550
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2551
|
+
className: "ds-l-md-col--3 ds-l-sm-col--12",
|
|
2552
|
+
children: [
|
|
2553
|
+
Object.keys(distribution).length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f341c2fd9bc53390$export$2e2bcd8739ae039), {
|
|
2554
|
+
downloadURL: distribution.data.downloadURL,
|
|
2555
|
+
type: fileFormat
|
|
2556
|
+
}) : "",
|
|
2557
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $17193a17e26a72da$export$2e2bcd8739ae039), {
|
|
2558
|
+
keywords: dataset.keyword
|
|
2559
|
+
}),
|
|
2560
|
+
Object.keys(distribution).length && fileFormat === "CSV" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2561
|
+
className: "dc-c-dataset-tags ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
|
|
2562
|
+
children: [
|
|
2563
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
2564
|
+
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",
|
|
2565
|
+
children: "API"
|
|
2566
|
+
}),
|
|
2567
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2568
|
+
variation: "transparent",
|
|
2569
|
+
onClick: ()=>window.scrollTo({
|
|
2570
|
+
behavior: "smooth",
|
|
2571
|
+
top: apiDocs.current.offsetTop
|
|
2572
|
+
}),
|
|
2573
|
+
children: "Scroll to dataset API"
|
|
2574
|
+
})
|
|
2575
|
+
]
|
|
2576
|
+
}) : ""
|
|
2577
|
+
]
|
|
2578
|
+
})
|
|
2579
|
+
]
|
|
2580
|
+
})
|
|
2581
|
+
});
|
|
2582
|
+
};
|
|
2583
|
+
$766b8e351dd607f5$var$DatasetBody.propTypes = {
|
|
2584
|
+
id: (0, $hgUW1$proptypes).string.isRequired,
|
|
2585
|
+
dataset: (0, $hgUW1$proptypes).object.isRequired
|
|
2586
|
+
};
|
|
2587
|
+
var $766b8e351dd607f5$export$2e2bcd8739ae039 = $766b8e351dd607f5$var$DatasetBody;
|
|
2588
|
+
|
|
2589
|
+
|
|
2590
|
+
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
|
|
2594
|
+
|
|
2595
|
+
const $28f16f59778efa64$export$82b1b1d517e5388a = {
|
|
2596
|
+
"R/P10Y": {
|
|
2597
|
+
name: "Decennial"
|
|
2598
|
+
},
|
|
2599
|
+
"R/P4Y": {
|
|
2600
|
+
name: "Quadrennial"
|
|
2601
|
+
},
|
|
2602
|
+
"R/P1Y": {
|
|
2603
|
+
name: "Annual"
|
|
2604
|
+
},
|
|
2605
|
+
"R/P2M": {
|
|
2606
|
+
name: "Bimonthly"
|
|
2607
|
+
},
|
|
2608
|
+
"R/P3.5D": {
|
|
2609
|
+
name: "Semiweekly"
|
|
2610
|
+
},
|
|
2611
|
+
"R/P1D": {
|
|
2612
|
+
name: "Daily"
|
|
2613
|
+
},
|
|
2614
|
+
"R/P2W": {
|
|
2615
|
+
name: "Biweekly"
|
|
2616
|
+
},
|
|
2617
|
+
"R/P6M": {
|
|
2618
|
+
name: "Semiannual"
|
|
2619
|
+
},
|
|
2620
|
+
"R/P2Y": {
|
|
2621
|
+
name: "Biennial"
|
|
2622
|
+
},
|
|
2623
|
+
"R/P3Y": {
|
|
2624
|
+
name: "Triennial"
|
|
2625
|
+
},
|
|
2626
|
+
"R/P0.33W": {
|
|
2627
|
+
name: "Three times a week"
|
|
2628
|
+
},
|
|
2629
|
+
"R/P0.33M": {
|
|
2630
|
+
name: "Three times a month"
|
|
2631
|
+
},
|
|
2632
|
+
"R/PT1S": {
|
|
2633
|
+
name: "Continuously updated"
|
|
2634
|
+
},
|
|
2635
|
+
"R/P1M": {
|
|
2636
|
+
name: "Monthly"
|
|
2637
|
+
},
|
|
2638
|
+
"R/P3M": {
|
|
2639
|
+
name: "Quarterly"
|
|
2640
|
+
},
|
|
2641
|
+
"R/P0.5M": {
|
|
2642
|
+
name: "Semimonthly"
|
|
2643
|
+
},
|
|
2644
|
+
"R/P4M": {
|
|
2645
|
+
name: "Three times a year"
|
|
2646
|
+
},
|
|
2647
|
+
"R/P1W": {
|
|
2648
|
+
name: "Weekly"
|
|
2649
|
+
},
|
|
2650
|
+
"R/PT1H": {
|
|
2651
|
+
name: "Hourly"
|
|
2652
|
+
},
|
|
2653
|
+
irregular: {
|
|
2654
|
+
name: "Irregular"
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
const $6da0396069e23175$export$bc27cf7ecf44639d = {
|
|
2660
|
+
modified: (data)=>{
|
|
2661
|
+
return [
|
|
2662
|
+
{
|
|
2663
|
+
label: "Modified",
|
|
2664
|
+
value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
|
|
2665
|
+
date: data
|
|
2666
|
+
})
|
|
2667
|
+
}
|
|
2668
|
+
];
|
|
2669
|
+
},
|
|
2670
|
+
issued: (data)=>{
|
|
2671
|
+
return [
|
|
2672
|
+
{
|
|
2673
|
+
label: "Issued",
|
|
2674
|
+
value: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
|
|
2675
|
+
date: data
|
|
2676
|
+
})
|
|
2677
|
+
}
|
|
2678
|
+
];
|
|
2679
|
+
},
|
|
2680
|
+
accrualPeriodicity: (data)=>{
|
|
2681
|
+
return [
|
|
2682
|
+
{
|
|
2683
|
+
label: "Frequency",
|
|
2684
|
+
value: (0, $28f16f59778efa64$export$82b1b1d517e5388a)[data].name
|
|
2685
|
+
}
|
|
2686
|
+
];
|
|
2687
|
+
},
|
|
2688
|
+
publisher: (data)=>{
|
|
2689
|
+
if (data.data && data.data.name) return [
|
|
2690
|
+
{
|
|
2691
|
+
label: "Publisher",
|
|
2692
|
+
value: data.data.name
|
|
2693
|
+
}
|
|
2694
|
+
];
|
|
2695
|
+
else return [];
|
|
2696
|
+
},
|
|
2697
|
+
identifier: (data)=>{
|
|
2698
|
+
return [
|
|
2699
|
+
{
|
|
2700
|
+
label: "Identifier",
|
|
2701
|
+
value: data
|
|
2702
|
+
}
|
|
2703
|
+
];
|
|
2704
|
+
},
|
|
2705
|
+
contactPoint: (data)=>{
|
|
2706
|
+
let rows = [];
|
|
2707
|
+
if (data.fn) rows.push({
|
|
2708
|
+
label: "Contact",
|
|
2709
|
+
value: data.fn
|
|
2710
|
+
});
|
|
2711
|
+
if (data.hasEmail) rows.push({
|
|
2712
|
+
label: "Contact Email",
|
|
2713
|
+
value: data.hasEmail
|
|
2714
|
+
});
|
|
2715
|
+
return rows;
|
|
2716
|
+
},
|
|
2717
|
+
bureauCode: (data)=>{
|
|
2718
|
+
if (data.length) return [
|
|
2719
|
+
{
|
|
2720
|
+
label: "Bureau Code",
|
|
2721
|
+
value: data[0]
|
|
2722
|
+
}
|
|
2723
|
+
];
|
|
2724
|
+
},
|
|
2725
|
+
programCode: (data)=>{
|
|
2726
|
+
if (data.length) return [
|
|
2727
|
+
{
|
|
2728
|
+
label: "Program Code",
|
|
2729
|
+
value: data[0]
|
|
2730
|
+
}
|
|
2731
|
+
];
|
|
2732
|
+
},
|
|
2733
|
+
theme: (data)=>{
|
|
2734
|
+
return [
|
|
2735
|
+
{
|
|
2736
|
+
label: "Category",
|
|
2737
|
+
value: data.map((theme)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
2738
|
+
to: `/datasets?theme[]=${theme.data}`,
|
|
2739
|
+
children: theme.data
|
|
2740
|
+
}, theme.data)).reduce((prev, curr)=>[
|
|
2741
|
+
prev,
|
|
2742
|
+
", ",
|
|
2743
|
+
curr
|
|
2744
|
+
])
|
|
2745
|
+
}
|
|
2746
|
+
];
|
|
2747
|
+
},
|
|
2748
|
+
keyword: (data)=>{
|
|
2749
|
+
return [
|
|
2750
|
+
{
|
|
2751
|
+
label: "Tags",
|
|
2752
|
+
value: data.map((keyword)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
2753
|
+
to: `/datasets?keyword[]=${keyword.data}`,
|
|
2754
|
+
children: keyword.data
|
|
2755
|
+
}, keyword.data)).reduce((prev, curr)=>[
|
|
2756
|
+
prev,
|
|
2757
|
+
", ",
|
|
2758
|
+
curr
|
|
2759
|
+
])
|
|
2760
|
+
}
|
|
2761
|
+
];
|
|
2762
|
+
},
|
|
2763
|
+
license: (data)=>{
|
|
2764
|
+
return [
|
|
2765
|
+
{
|
|
2766
|
+
label: "License",
|
|
2767
|
+
value: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
|
|
2768
|
+
href: data,
|
|
2769
|
+
children: data
|
|
2770
|
+
})
|
|
2771
|
+
}
|
|
2772
|
+
];
|
|
2773
|
+
},
|
|
2774
|
+
accessLevel: (data)=>{
|
|
2775
|
+
return [
|
|
2776
|
+
{
|
|
2777
|
+
label: "Public Access Level",
|
|
2778
|
+
value: data
|
|
2779
|
+
}
|
|
2780
|
+
];
|
|
2781
|
+
},
|
|
2782
|
+
temporal: (data)=>{
|
|
2783
|
+
return [
|
|
2784
|
+
{
|
|
2785
|
+
label: "Temporal Coverage",
|
|
2786
|
+
value: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2787
|
+
className: "dc-c-word-break--all",
|
|
2788
|
+
children: data
|
|
2789
|
+
})
|
|
2790
|
+
}
|
|
2791
|
+
];
|
|
2792
|
+
},
|
|
2793
|
+
spatial: (data)=>{
|
|
2794
|
+
return [
|
|
2795
|
+
{
|
|
2796
|
+
label: "Spacial/Geographical Coverage",
|
|
2797
|
+
value: data
|
|
2798
|
+
}
|
|
2799
|
+
];
|
|
2800
|
+
},
|
|
2801
|
+
references: (data)=>{
|
|
2802
|
+
return [
|
|
2803
|
+
{
|
|
2804
|
+
label: "Related Documents",
|
|
2805
|
+
value: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
2806
|
+
className: "ds-u-margin--0 ds-u-padding-y--0 ds-u-padding-left--2 ds-u-padding-right--0",
|
|
2807
|
+
children: data.map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
2808
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("a", {
|
|
2809
|
+
href: item,
|
|
2810
|
+
children: item
|
|
2811
|
+
})
|
|
2812
|
+
}, item))
|
|
2813
|
+
})
|
|
2814
|
+
}
|
|
2815
|
+
];
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
|
|
2819
|
+
|
|
2820
|
+
const $6e7bdcbebdb4b794$var$Dataset = ({ id: id , rootUrl: rootUrl , additionalParams: additionalParams , customColumns: customColumns , setDatasetTitle: setDatasetTitle , columnSettings: columnSettings , columnWidths: columnWidths , customMetadataMapping: customMetadataMapping })=>{
|
|
2821
|
+
const metastore = (0, $68d79598b83f3382$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
|
|
2822
|
+
const { dataset: dataset } = metastore;
|
|
2823
|
+
const title = dataset.title ? dataset.title : "";
|
|
2824
|
+
const metadataMapping = {
|
|
2825
|
+
...(0, $6da0396069e23175$export$bc27cf7ecf44639d),
|
|
2826
|
+
...customMetadataMapping
|
|
2827
|
+
};
|
|
2828
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
2829
|
+
if (title) {
|
|
2830
|
+
if (setDatasetTitle) setDatasetTitle(title);
|
|
2831
|
+
}
|
|
2832
|
+
}, [
|
|
2833
|
+
title
|
|
2834
|
+
]);
|
|
2835
|
+
const notFoundContent = /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2836
|
+
className: "ds-u-padding-top--3",
|
|
2837
|
+
children: [
|
|
2838
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h1", {
|
|
2839
|
+
className: "ds-title",
|
|
2840
|
+
children: "Error: Dataset not found"
|
|
2841
|
+
}),
|
|
2842
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
2843
|
+
children: "We're sorry, but there is no dataset ID that matches your entry. You may have been directed here because:"
|
|
2844
|
+
}),
|
|
2845
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
|
|
2846
|
+
children: [
|
|
2847
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
2848
|
+
children: "The address you typed contains a typo;"
|
|
2849
|
+
}),
|
|
2850
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
2851
|
+
children: "The requested dataset no longer exists."
|
|
2852
|
+
})
|
|
2853
|
+
]
|
|
2854
|
+
}),
|
|
2855
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
|
|
2856
|
+
children: [
|
|
2857
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2858
|
+
className: "ds-u-font-weight--bold",
|
|
2859
|
+
children: "Note:"
|
|
2860
|
+
}),
|
|
2861
|
+
" If you were using a bookmark, please reset it once you find the correct dataset."
|
|
2862
|
+
]
|
|
2863
|
+
})
|
|
2864
|
+
]
|
|
2865
|
+
});
|
|
2866
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
2867
|
+
children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
|
|
2868
|
+
content: notFoundContent
|
|
2869
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $766b8e351dd607f5$export$2e2bcd8739ae039), {
|
|
2870
|
+
rootUrl: rootUrl,
|
|
2871
|
+
id: id,
|
|
2872
|
+
dataset: dataset,
|
|
2873
|
+
additionalParams: additionalParams,
|
|
2874
|
+
customColumns: customColumns ? customColumns : [],
|
|
2875
|
+
columnSettings: columnSettings,
|
|
2876
|
+
columnWidths: columnWidths,
|
|
2877
|
+
metadataMapping: metadataMapping
|
|
2878
|
+
})
|
|
2879
|
+
});
|
|
2880
|
+
};
|
|
2881
|
+
$6e7bdcbebdb4b794$var$Dataset.propTypes = {
|
|
2882
|
+
id: (0, $hgUW1$proptypes).string.isRequired,
|
|
2883
|
+
rootUrl: (0, $hgUW1$proptypes).string.isRequired
|
|
2884
|
+
};
|
|
2885
|
+
var $6e7bdcbebdb4b794$export$2e2bcd8739ae039 = $6e7bdcbebdb4b794$var$Dataset;
|
|
2886
|
+
|
|
2887
|
+
|
|
2888
|
+
|
|
2889
|
+
|
|
2890
|
+
|
|
269
2891
|
// export { default as NavLink } from './components/NavLink';
|
|
270
2892
|
// export { default as DatasetTags } from './components/DatasetTags';
|
|
271
2893
|
// export { default as DatasetDownloads } from './components/DatasetDownloads';
|
|
@@ -299,5 +2921,5 @@ var $026cb986f9fea2b1$export$2e2bcd8739ae039 = $026cb986f9fea2b1$var$PageNotFoun
|
|
|
299
2921
|
// export { default as frequencyMap } from './assets/frequencyMap';
|
|
300
2922
|
|
|
301
2923
|
|
|
302
|
-
export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $ca4d58501b237b60$export$2e2bcd8739ae039 as Header, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound};
|
|
2924
|
+
export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $ca4d58501b237b60$export$2e2bcd8739ae039 as Header, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $007dd6bfbe0f2956$export$2e2bcd8739ae039 as DatasetSearch, $6e7bdcbebdb4b794$export$2e2bcd8739ae039 as Dataset, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI};
|
|
303
2925
|
//# sourceMappingURL=main.js.map
|