@civicactions/cmsds-open-data-components 4.1.7-alpha.4 → 4.1.8-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.css +87 -87
- package/dist/main.css.map +1 -1
- package/dist/main.js +218 -209
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +23 -20
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {jsx as $hgUW1$jsx, jsxs as $hgUW1$jsxs, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
|
|
3
|
-
import {Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Button as $hgUW1$Button, CloseIconThin as $hgUW1$CloseIconThin, ArrowIcon as $hgUW1$ArrowIcon,
|
|
4
|
-
import $hgUW1$react, {createContext as $hgUW1$createContext, useState as $hgUW1$useState,
|
|
5
|
-
import {NavLink as $hgUW1$NavLink,
|
|
3
|
+
import {Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Button as $hgUW1$Button, CloseIconThin as $hgUW1$CloseIconThin, ArrowIcon as $hgUW1$ArrowIcon, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Choice as $hgUW1$Choice, Table as $hgUW1$Table, TableHead as $hgUW1$TableHead, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableBody as $hgUW1$TableBody, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, ExternalLinkIcon as $hgUW1$ExternalLinkIcon, Badge as $hgUW1$Badge} from "@cmsgov/design-system";
|
|
4
|
+
import $hgUW1$react, {createContext as $hgUW1$createContext, useState as $hgUW1$useState, useEffect as $hgUW1$useEffect, useRef as $hgUW1$useRef, useContext as $hgUW1$useContext, useMemo as $hgUW1$useMemo, useCallback as $hgUW1$useCallback} from "react";
|
|
5
|
+
import {NavLink as $hgUW1$NavLink, useLocation as $hgUW1$useLocation, useNavigate as $hgUW1$useNavigate, useSearchParams as $hgUW1$useSearchParams, Link as $hgUW1$Link} from "react-router-dom";
|
|
6
6
|
import $hgUW1$qs from "qs";
|
|
7
7
|
import $hgUW1$axios from "axios";
|
|
8
8
|
import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryClientProvider as $hgUW1$QueryClientProvider} from "@tanstack/react-query";
|
|
@@ -271,198 +271,6 @@ var $11500a65bd7d9cf1$export$2e2bcd8739ae039 = $11500a65bd7d9cf1$var$HeaderConte
|
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)({
|
|
279
|
-
defaultOptions: {
|
|
280
|
-
queries: {
|
|
281
|
-
refetchOnWindowFocus: false
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
const $61ff88fb3f6ee2c8$var$withQueryProvider = (WrappedComponent)=>(props)=>{
|
|
286
|
-
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$QueryClientProvider), {
|
|
287
|
-
client: $61ff88fb3f6ee2c8$var$queryClient,
|
|
288
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)(WrappedComponent, {
|
|
289
|
-
...props
|
|
290
|
-
})
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryProvider;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const $4808982eba3feb88$var$DatasetListSubmenuItem = (props)=>{
|
|
302
|
-
const { title: title, identifier: identifier, linkClasses: linkClasses } = props;
|
|
303
|
-
return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
304
|
-
className: "dc-c-list-item",
|
|
305
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
306
|
-
className: `ds-u-display-flex ds-u-align-items--center ds-u-text-align--left ${linkClasses}`,
|
|
307
|
-
to: `/dataset/${identifier}`,
|
|
308
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
309
|
-
className: "ds-text-heading--md ds-u-margin-left--0",
|
|
310
|
-
children: title
|
|
311
|
-
})
|
|
312
|
-
})
|
|
313
|
-
}, identifier);
|
|
314
|
-
};
|
|
315
|
-
var $4808982eba3feb88$export$2e2bcd8739ae039 = $4808982eba3feb88$var$DatasetListSubmenuItem;
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
function $6d5c0212e738499b$export$34e95918366a058e(params, ACA) {
|
|
321
|
-
if (ACA) params = Object.assign(params, {
|
|
322
|
-
ACA: ACA,
|
|
323
|
-
redirect: false
|
|
324
|
-
});
|
|
325
|
-
return params;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const $844981eac9b63865$export$eccc29c8d0ff408 = (0, $hgUW1$createContext)({
|
|
331
|
-
ACA: undefined
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const $10bc3aae21fc1572$var$DatasetListSubmenu = ({ rootUrl: rootUrl, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 4, defaultSort: defaultSort = {
|
|
336
|
-
defaultSort: 'modified',
|
|
337
|
-
defaultOrder: 'desc'
|
|
338
|
-
}, subLinkClasses: subLinkClasses })=>{
|
|
339
|
-
const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
|
|
340
|
-
const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)({
|
|
341
|
-
total: 0,
|
|
342
|
-
startingNumber: 0,
|
|
343
|
-
endingNumber: 0
|
|
344
|
-
});
|
|
345
|
-
const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
|
|
346
|
-
const [totalItems, setTotalItems] = (0, $hgUW1$useState)(0);
|
|
347
|
-
const pageSize = defaultPageSize;
|
|
348
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
349
|
-
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
350
|
-
else setNoResults(false);
|
|
351
|
-
}, [
|
|
352
|
-
totalItems,
|
|
353
|
-
pageSize
|
|
354
|
-
]);
|
|
355
|
-
let params = {
|
|
356
|
-
sort: defaultSort.defaultSort,
|
|
357
|
-
['sort-order']: defaultSort.defaultOrder,
|
|
358
|
-
['page-size']: defaultPageSize
|
|
359
|
-
};
|
|
360
|
-
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
361
|
-
queryKey: [
|
|
362
|
-
"datasets",
|
|
363
|
-
params
|
|
364
|
-
],
|
|
365
|
-
queryFn: ()=>{
|
|
366
|
-
return (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA), {
|
|
367
|
-
arrayFormat: 'comma',
|
|
368
|
-
encode: false
|
|
369
|
-
})}`);
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
// Sync totalItems state with API response data
|
|
373
|
-
// Moved to useEffect to prevent state updates during render (which can cause infinite loops)
|
|
374
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
375
|
-
if (data?.data?.total !== undefined && data.data.total !== totalItems) setTotalItems(data.data.total);
|
|
376
|
-
}, [
|
|
377
|
-
data?.data?.total
|
|
378
|
-
]);
|
|
379
|
-
let submenuItemsCount = 0;
|
|
380
|
-
if (data) {
|
|
381
|
-
let resultsCount = Object.keys(data.data.results).length;
|
|
382
|
-
// For the submenu pager, If there are fewer than 4 dataset items, display the dataset item count, otherwise, show "Viewing 4..".
|
|
383
|
-
submenuItemsCount = resultsCount > defaultPageSize ? defaultPageSize : resultsCount;
|
|
384
|
-
}
|
|
385
|
-
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
386
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
|
|
387
|
-
className: " dkan-c-site-menu--sub-menu",
|
|
388
|
-
children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
389
|
-
className: "ds-u-valign--middle",
|
|
390
|
-
"aria-valuetext": "Dataset Search loading",
|
|
391
|
-
role: "status"
|
|
392
|
-
}) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
393
|
-
children: [
|
|
394
|
-
/*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
|
|
395
|
-
className: "dc-dataset-search-list ds-u-padding--0 ds-u-margin-top--0 ds-u-lg-margin-top--2 ds-u-margin-bottom--2 ds-u-display--block",
|
|
396
|
-
"data-testid": "submenu-results-list",
|
|
397
|
-
children: [
|
|
398
|
-
noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
399
|
-
variation: "error",
|
|
400
|
-
heading: "No results found."
|
|
401
|
-
}),
|
|
402
|
-
data && data.data.results ? Object.keys(data.data.results).map((key)=>{
|
|
403
|
-
return data.data.results[key];
|
|
404
|
-
}).map((item)=>{
|
|
405
|
-
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4808982eba3feb88$export$2e2bcd8739ae039), {
|
|
406
|
-
title: item.title,
|
|
407
|
-
identifier: item.identifier,
|
|
408
|
-
linkClasses: subLinkClasses
|
|
409
|
-
}, item.identifier);
|
|
410
|
-
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
411
|
-
variation: "error",
|
|
412
|
-
heading: "Could not connect to the API."
|
|
413
|
-
})
|
|
414
|
-
]
|
|
415
|
-
}),
|
|
416
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
417
|
-
className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center ds-u-border-top--1 ds-u-padding-top--3 ds-u-padding-bottom--2 ds-u-margin-x--3 ds-u-lg-margin-x--0",
|
|
418
|
-
children: enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
419
|
-
children: [
|
|
420
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
421
|
-
className: "",
|
|
422
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
423
|
-
className: "ds-u-margin-y--0 ds-u-font-size--sm",
|
|
424
|
-
"aria-hidden": "true",
|
|
425
|
-
children: data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
426
|
-
children: [
|
|
427
|
-
"Viewing ",
|
|
428
|
-
submenuItemsCount,
|
|
429
|
-
" of ",
|
|
430
|
-
data.data.total
|
|
431
|
-
]
|
|
432
|
-
})
|
|
433
|
-
})
|
|
434
|
-
}),
|
|
435
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
436
|
-
className: "",
|
|
437
|
-
children: data && data.data.total > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
438
|
-
className: "ds-u-padding--0 ds-c-button ds-c-button--ghost dkan-c-header--link",
|
|
439
|
-
to: `../whats-new`,
|
|
440
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
441
|
-
className: "ds-text-heading--md",
|
|
442
|
-
children: [
|
|
443
|
-
" ",
|
|
444
|
-
`View all ${data.data.total} entries`,
|
|
445
|
-
" "
|
|
446
|
-
]
|
|
447
|
-
})
|
|
448
|
-
})
|
|
449
|
-
})
|
|
450
|
-
]
|
|
451
|
-
})
|
|
452
|
-
})
|
|
453
|
-
]
|
|
454
|
-
})
|
|
455
|
-
})
|
|
456
|
-
});
|
|
457
|
-
};
|
|
458
|
-
var $10bc3aae21fc1572$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($10bc3aae21fc1572$var$DatasetListSubmenu);
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
274
|
const $6d0cf21faac6a2dd$var$SubMenuStaticList = ({ submenuArray: submenuArray, subLinkClasses: subLinkClasses, setIsExpanded: setIsExpanded })=>{
|
|
467
275
|
// Render a static list of submenu items as listed in the assets/menu.jsx file.
|
|
468
276
|
let submenuItems = submenuArray.map((s)=>{
|
|
@@ -479,7 +287,7 @@ const $6d0cf21faac6a2dd$var$SubMenuStaticList = ({ submenuArray: submenuArray, s
|
|
|
479
287
|
}) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$NavLink), {
|
|
480
288
|
to: s.url,
|
|
481
289
|
className: `ds-u-display-flex ds-u-align-items--center ${subLinkClasses}`,
|
|
482
|
-
onClick: ()=>setIsExpanded(
|
|
290
|
+
onClick: ()=>setIsExpanded(false),
|
|
483
291
|
children: [
|
|
484
292
|
s.icon ?? null,
|
|
485
293
|
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
@@ -500,6 +308,12 @@ var $6d0cf21faac6a2dd$export$2e2bcd8739ae039 = $6d0cf21faac6a2dd$var$SubMenuStat
|
|
|
500
308
|
const $669b51f08325b4e3$var$SubMenu = ({ link: link, linkClasses: linkClasses, subLinkClasses: subLinkClasses, wrapLabel: wrapLabel = true })=>{
|
|
501
309
|
const [isExpanded, setIsExpanded] = (0, $hgUW1$useState)(false);
|
|
502
310
|
const headerContext = (0, $hgUW1$react).useContext((0, $11500a65bd7d9cf1$export$2e2bcd8739ae039));
|
|
311
|
+
const location = (0, $hgUW1$useLocation)();
|
|
312
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
313
|
+
setIsExpanded(false);
|
|
314
|
+
}, [
|
|
315
|
+
location
|
|
316
|
+
]);
|
|
503
317
|
const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
504
318
|
children: link.label
|
|
505
319
|
}) : link.label;
|
|
@@ -529,14 +343,9 @@ const $669b51f08325b4e3$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
|
|
|
529
343
|
subLinkClasses: subLinkClasses,
|
|
530
344
|
setIsExpanded: setIsExpanded
|
|
531
345
|
});
|
|
532
|
-
else if (/*#__PURE__*/ (0, $hgUW1$react).isValidElement(link.submenu)) {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
location: location,
|
|
536
|
-
rootUrl: rootUrl,
|
|
537
|
-
subLinkClasses: subLinkClasses
|
|
538
|
-
});
|
|
539
|
-
}
|
|
346
|
+
else if (/*#__PURE__*/ (0, $hgUW1$react).isValidElement(link.submenu)) submenuBlock = /*#__PURE__*/ (0, $hgUW1$react).cloneElement(link.submenu, {
|
|
347
|
+
subLinkClasses: subLinkClasses
|
|
348
|
+
});
|
|
540
349
|
}
|
|
541
350
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
542
351
|
className: `dkan-c-nav-submenu has-submenu${isExpanded ? ' open' : ''}`,
|
|
@@ -579,6 +388,26 @@ var $669b51f08325b4e3$export$2e2bcd8739ae039 = $669b51f08325b4e3$var$SubMenu;
|
|
|
579
388
|
|
|
580
389
|
|
|
581
390
|
|
|
391
|
+
const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)({
|
|
392
|
+
defaultOptions: {
|
|
393
|
+
queries: {
|
|
394
|
+
refetchOnWindowFocus: false
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
const $61ff88fb3f6ee2c8$var$withQueryProvider = (WrappedComponent)=>(props)=>{
|
|
399
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$QueryClientProvider), {
|
|
400
|
+
client: $61ff88fb3f6ee2c8$var$queryClient,
|
|
401
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)(WrappedComponent, {
|
|
402
|
+
...props
|
|
403
|
+
})
|
|
404
|
+
});
|
|
405
|
+
};
|
|
406
|
+
var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryProvider;
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
582
411
|
|
|
583
412
|
|
|
584
413
|
|
|
@@ -1368,6 +1197,14 @@ var $5723016a5461c1ca$export$2e2bcd8739ae039 = $5723016a5461c1ca$var$PageHeader;
|
|
|
1368
1197
|
|
|
1369
1198
|
|
|
1370
1199
|
|
|
1200
|
+
function $6d5c0212e738499b$export$34e95918366a058e(params, ACA) {
|
|
1201
|
+
if (ACA) params = Object.assign(params, {
|
|
1202
|
+
ACA: ACA,
|
|
1203
|
+
redirect: false
|
|
1204
|
+
});
|
|
1205
|
+
return params;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1371
1208
|
|
|
1372
1209
|
function $eff7d34c30f5a0fc$export$959638e8dca60ce6(facets) {
|
|
1373
1210
|
let facetObj = {};
|
|
@@ -1425,6 +1262,11 @@ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, ACA)
|
|
|
1425
1262
|
|
|
1426
1263
|
|
|
1427
1264
|
|
|
1265
|
+
const $844981eac9b63865$export$eccc29c8d0ff408 = (0, $hgUW1$createContext)({
|
|
1266
|
+
ACA: undefined
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
|
|
1428
1270
|
const $e873081a6e8f024e$export$1040147c129fdde9 = (query)=>{
|
|
1429
1271
|
return /^[a-zA-Z0-9 ]*$/.test(query.trim());
|
|
1430
1272
|
};
|
|
@@ -1450,10 +1292,11 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1450
1292
|
const { rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
|
|
1451
1293
|
defaultSort: 'modified',
|
|
1452
1294
|
defaultOrder: 'desc'
|
|
1453
|
-
}, pageTitle: pageTitle = 'Dataset Explorer', categoriesTitle: categoriesTitle = 'Categories', filterTitle: filterTitle = 'Tags', showLargeFileWarning: showLargeFileWarning = false, largeFileThemes: largeFileThemes, introText: introText = '', showDownloadIcon: showDownloadIcon = false, altMobileSearchButton: altMobileSearchButton, dataDictionaryLinks: dataDictionaryLinks = false, showDateDetails: showDateDetails = false, updateDateMonthYearOnly: updateDateMonthYearOnly = false, showTopics: showTopics = false, topicSlugFunction: topicSlugFunction, children: children } = props;
|
|
1295
|
+
}, pageTitle: pageTitle = 'Dataset Explorer', categoriesTitle: categoriesTitle = 'Categories', filterTitle: filterTitle = 'Tags', showLargeFileWarning: showLargeFileWarning = false, largeFileThemes: largeFileThemes, introText: introText = '', showDownloadIcon: showDownloadIcon = false, altMobileSearchButton: altMobileSearchButton, dataDictionaryLinks: dataDictionaryLinks = false, showDateDetails: showDateDetails = false, updateDateMonthYearOnly: updateDateMonthYearOnly = false, showTopics: showTopics = false, topicSlugFunction: topicSlugFunction, analytics: analytics = false, onAnalyticsEvent: onAnalyticsEvent = ()=>{}, children: children } = props;
|
|
1454
1296
|
const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
|
|
1455
1297
|
const [searchParams] = (0, $hgUW1$useSearchParams)();
|
|
1456
1298
|
const navigate = (0, $hgUW1$useNavigate)();
|
|
1299
|
+
const location = (0, $hgUW1$useLocation)();
|
|
1457
1300
|
// Derive all search state from URL params
|
|
1458
1301
|
const selectedFacets = (0, $hgUW1$useMemo)(()=>{
|
|
1459
1302
|
const parsed = (0, $hgUW1$qs).parse(searchParams.toString());
|
|
@@ -1601,6 +1444,12 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1601
1444
|
noResults,
|
|
1602
1445
|
currentResultNumbers
|
|
1603
1446
|
]);
|
|
1447
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1448
|
+
if (analytics && location.search) onAnalyticsEvent(location);
|
|
1449
|
+
}, [
|
|
1450
|
+
analytics,
|
|
1451
|
+
location.search
|
|
1452
|
+
]);
|
|
1604
1453
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
1605
1454
|
children: [
|
|
1606
1455
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $5723016a5461c1ca$export$2e2bcd8739ae039), {
|
|
@@ -3458,8 +3307,8 @@ function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
|
|
|
3458
3307
|
accessor: column
|
|
3459
3308
|
}));
|
|
3460
3309
|
}
|
|
3461
|
-
const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopyLinkButton: showCopyLinkButton = true, showDataTableToolbar: showDataTableToolbar = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false, showTableResults: showTableResults = true, showFilterDatasetButton: showFilterDatasetButton = true, showManageColumnsButton: showManageColumnsButton = true, showDisplaySettingsButton: showDisplaySettingsButton = true, showFullScreenButton: showFullScreenButton = true, showInfoShareContainer: showInfoShareContainer = true
|
|
3462
|
-
const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3310
|
+
const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopyLinkButton: showCopyLinkButton = true, showDataTableToolbar: showDataTableToolbar = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false, showTableResults: showTableResults = true, showFilterDatasetButton: showFilterDatasetButton = true, showManageColumnsButton: showManageColumnsButton = true, showDisplaySettingsButton: showDisplaySettingsButton = true, showFullScreenButton: showFullScreenButton = true, showInfoShareContainer: showInfoShareContainer = true })=>{
|
|
3311
|
+
const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner, relativeHomeUrlPrepend: relativeHomeUrlPrepend } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3463
3312
|
const { page: page, setPage: setPage, tableDensity: tableDensity } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
3464
3313
|
const defaultPageSize = 10;
|
|
3465
3314
|
const schema = resource?.schema?.[distribution?.identifier] ?? resource?.schema?.[id];
|
|
@@ -3547,7 +3396,7 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopy
|
|
|
3547
3396
|
children: useDatastoreErrorMessages[resourceErrorStatus].message
|
|
3548
3397
|
}),
|
|
3549
3398
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3550
|
-
href:
|
|
3399
|
+
href: `${relativeHomeUrlPrepend}/`,
|
|
3551
3400
|
variation: "solid",
|
|
3552
3401
|
className: "",
|
|
3553
3402
|
children: "Go to home"
|
|
@@ -4397,6 +4246,165 @@ var $85f8ff1ff89899c7$export$2e2bcd8739ae039 = $85f8ff1ff89899c7$var$DataTableTo
|
|
|
4397
4246
|
|
|
4398
4247
|
|
|
4399
4248
|
|
|
4249
|
+
|
|
4250
|
+
|
|
4251
|
+
|
|
4252
|
+
|
|
4253
|
+
|
|
4254
|
+
const $4808982eba3feb88$var$DatasetListSubmenuItem = (props)=>{
|
|
4255
|
+
const { title: title, identifier: identifier, linkClasses: linkClasses } = props;
|
|
4256
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
4257
|
+
className: "dc-c-list-item",
|
|
4258
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
4259
|
+
className: `ds-u-display-flex ds-u-align-items--center ds-u-text-align--left ${linkClasses}`,
|
|
4260
|
+
to: `/dataset/${identifier}`,
|
|
4261
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
4262
|
+
className: "ds-text-heading--md ds-u-margin-left--0",
|
|
4263
|
+
children: title
|
|
4264
|
+
})
|
|
4265
|
+
})
|
|
4266
|
+
}, identifier);
|
|
4267
|
+
};
|
|
4268
|
+
var $4808982eba3feb88$export$2e2bcd8739ae039 = $4808982eba3feb88$var$DatasetListSubmenuItem;
|
|
4269
|
+
|
|
4270
|
+
|
|
4271
|
+
|
|
4272
|
+
|
|
4273
|
+
|
|
4274
|
+
|
|
4275
|
+
const $10bc3aae21fc1572$var$DatasetListSubmenu = ({ rootUrl: rootUrl, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 4, defaultSort: defaultSort = {
|
|
4276
|
+
defaultSort: 'modified',
|
|
4277
|
+
defaultOrder: 'desc'
|
|
4278
|
+
}, subLinkClasses: subLinkClasses })=>{
|
|
4279
|
+
const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
|
|
4280
|
+
const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)({
|
|
4281
|
+
total: 0,
|
|
4282
|
+
startingNumber: 0,
|
|
4283
|
+
endingNumber: 0
|
|
4284
|
+
});
|
|
4285
|
+
const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
|
|
4286
|
+
const [totalItems, setTotalItems] = (0, $hgUW1$useState)(0);
|
|
4287
|
+
const pageSize = defaultPageSize;
|
|
4288
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4289
|
+
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
4290
|
+
else setNoResults(false);
|
|
4291
|
+
}, [
|
|
4292
|
+
totalItems,
|
|
4293
|
+
pageSize
|
|
4294
|
+
]);
|
|
4295
|
+
let params = {
|
|
4296
|
+
sort: defaultSort.defaultSort,
|
|
4297
|
+
['sort-order']: defaultSort.defaultOrder,
|
|
4298
|
+
['page-size']: defaultPageSize
|
|
4299
|
+
};
|
|
4300
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
4301
|
+
queryKey: [
|
|
4302
|
+
"datasets",
|
|
4303
|
+
params
|
|
4304
|
+
],
|
|
4305
|
+
queryFn: ()=>{
|
|
4306
|
+
return (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA), {
|
|
4307
|
+
arrayFormat: 'comma',
|
|
4308
|
+
encode: false
|
|
4309
|
+
})}`);
|
|
4310
|
+
}
|
|
4311
|
+
});
|
|
4312
|
+
// Sync totalItems state with API response data
|
|
4313
|
+
// Moved to useEffect to prevent state updates during render (which can cause infinite loops)
|
|
4314
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4315
|
+
if (data?.data?.total !== undefined && data.data.total !== totalItems) setTotalItems(data.data.total);
|
|
4316
|
+
}, [
|
|
4317
|
+
data?.data?.total
|
|
4318
|
+
]);
|
|
4319
|
+
let submenuItemsCount = 0;
|
|
4320
|
+
if (data) {
|
|
4321
|
+
let resultsCount = Object.keys(data.data.results).length;
|
|
4322
|
+
// For the submenu pager, If there are fewer than 4 dataset items, display the dataset item count, otherwise, show "Viewing 4..".
|
|
4323
|
+
submenuItemsCount = resultsCount > defaultPageSize ? defaultPageSize : resultsCount;
|
|
4324
|
+
}
|
|
4325
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
4326
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
|
|
4327
|
+
className: " dkan-c-site-menu--sub-menu",
|
|
4328
|
+
children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
4329
|
+
className: "ds-u-valign--middle",
|
|
4330
|
+
"aria-valuetext": "Dataset Search loading",
|
|
4331
|
+
role: "status"
|
|
4332
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4333
|
+
children: [
|
|
4334
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
|
|
4335
|
+
className: "dc-dataset-search-list ds-u-padding--0 ds-u-margin-top--0 ds-u-lg-margin-top--2 ds-u-margin-bottom--2 ds-u-display--block",
|
|
4336
|
+
"data-testid": "submenu-results-list",
|
|
4337
|
+
children: [
|
|
4338
|
+
noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4339
|
+
variation: "error",
|
|
4340
|
+
heading: "No results found."
|
|
4341
|
+
}),
|
|
4342
|
+
data && data.data.results ? Object.keys(data.data.results).map((key)=>{
|
|
4343
|
+
return data.data.results[key];
|
|
4344
|
+
}).map((item)=>{
|
|
4345
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4808982eba3feb88$export$2e2bcd8739ae039), {
|
|
4346
|
+
title: item.title,
|
|
4347
|
+
identifier: item.identifier,
|
|
4348
|
+
linkClasses: subLinkClasses
|
|
4349
|
+
}, item.identifier);
|
|
4350
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4351
|
+
variation: "error",
|
|
4352
|
+
heading: "Could not connect to the API."
|
|
4353
|
+
})
|
|
4354
|
+
]
|
|
4355
|
+
}),
|
|
4356
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4357
|
+
className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center ds-u-border-top--1 ds-u-padding-top--3 ds-u-padding-bottom--2 ds-u-margin-x--3 ds-u-lg-margin-x--0",
|
|
4358
|
+
children: enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4359
|
+
children: [
|
|
4360
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4361
|
+
className: "",
|
|
4362
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
4363
|
+
className: "ds-u-margin-y--0 ds-u-font-size--sm",
|
|
4364
|
+
"aria-hidden": "true",
|
|
4365
|
+
children: data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4366
|
+
children: [
|
|
4367
|
+
"Viewing ",
|
|
4368
|
+
submenuItemsCount,
|
|
4369
|
+
" of ",
|
|
4370
|
+
data.data.total
|
|
4371
|
+
]
|
|
4372
|
+
})
|
|
4373
|
+
})
|
|
4374
|
+
}),
|
|
4375
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4376
|
+
className: "",
|
|
4377
|
+
children: data && data.data.total > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
4378
|
+
className: "ds-u-padding--0 ds-c-button ds-c-button--ghost dkan-c-header--link",
|
|
4379
|
+
to: `../whats-new`,
|
|
4380
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
4381
|
+
className: "ds-text-heading--md",
|
|
4382
|
+
children: [
|
|
4383
|
+
" ",
|
|
4384
|
+
`View all ${data.data.total} entries`,
|
|
4385
|
+
" "
|
|
4386
|
+
]
|
|
4387
|
+
})
|
|
4388
|
+
})
|
|
4389
|
+
})
|
|
4390
|
+
]
|
|
4391
|
+
})
|
|
4392
|
+
})
|
|
4393
|
+
]
|
|
4394
|
+
})
|
|
4395
|
+
})
|
|
4396
|
+
});
|
|
4397
|
+
};
|
|
4398
|
+
var $10bc3aae21fc1572$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($10bc3aae21fc1572$var$DatasetListSubmenu);
|
|
4399
|
+
|
|
4400
|
+
|
|
4401
|
+
|
|
4402
|
+
|
|
4403
|
+
|
|
4404
|
+
|
|
4405
|
+
|
|
4406
|
+
|
|
4407
|
+
|
|
4400
4408
|
const $5b656f0283afa250$var$SpanOpenAPIVersion = function(system) {
|
|
4401
4409
|
return {
|
|
4402
4410
|
wrapComponents: {
|
|
@@ -7462,7 +7470,8 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
|
|
|
7462
7470
|
customColumns: customColumns,
|
|
7463
7471
|
dataDictionaryBanner: dataDictionaryBanner && displayDataDictionaryTab,
|
|
7464
7472
|
datasetTableControls: !disableTableControls,
|
|
7465
|
-
enableEmptyFilters: enableEmptyFilters
|
|
7473
|
+
enableEmptyFilters: enableEmptyFilters,
|
|
7474
|
+
relativeHomeUrlPrepend: tabHrefPrepend
|
|
7466
7475
|
},
|
|
7467
7476
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {})
|
|
7468
7477
|
}) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|