@civicactions/cmsds-open-data-components 4.1.7-alpha.4 → 4.1.7
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 +210 -208
- 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,
|
|
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
4
|
import $hgUW1$react, {createContext as $hgUW1$createContext, useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect, useContext as $hgUW1$useContext, useMemo as $hgUW1$useMemo, useCallback as $hgUW1$useCallback} from "react";
|
|
5
|
-
import {NavLink as $hgUW1$NavLink,
|
|
5
|
+
import {NavLink as $hgUW1$NavLink, useNavigate as $hgUW1$useNavigate, useSearchParams as $hgUW1$useSearchParams, useLocation as $hgUW1$useLocation, 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";
|
|
@@ -270,199 +270,6 @@ var $11500a65bd7d9cf1$export$2e2bcd8739ae039 = $11500a65bd7d9cf1$var$HeaderConte
|
|
|
270
270
|
|
|
271
271
|
|
|
272
272
|
|
|
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
273
|
const $6d0cf21faac6a2dd$var$SubMenuStaticList = ({ submenuArray: submenuArray, subLinkClasses: subLinkClasses, setIsExpanded: setIsExpanded })=>{
|
|
467
274
|
// Render a static list of submenu items as listed in the assets/menu.jsx file.
|
|
468
275
|
let submenuItems = submenuArray.map((s)=>{
|
|
@@ -529,14 +336,9 @@ const $669b51f08325b4e3$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
|
|
|
529
336
|
subLinkClasses: subLinkClasses,
|
|
530
337
|
setIsExpanded: setIsExpanded
|
|
531
338
|
});
|
|
532
|
-
else if (/*#__PURE__*/ (0, $hgUW1$react).isValidElement(link.submenu)) {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
location: location,
|
|
536
|
-
rootUrl: rootUrl,
|
|
537
|
-
subLinkClasses: subLinkClasses
|
|
538
|
-
});
|
|
539
|
-
}
|
|
339
|
+
else if (/*#__PURE__*/ (0, $hgUW1$react).isValidElement(link.submenu)) submenuBlock = /*#__PURE__*/ (0, $hgUW1$react).cloneElement(link.submenu, {
|
|
340
|
+
subLinkClasses: subLinkClasses
|
|
341
|
+
});
|
|
540
342
|
}
|
|
541
343
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
542
344
|
className: `dkan-c-nav-submenu has-submenu${isExpanded ? ' open' : ''}`,
|
|
@@ -579,6 +381,26 @@ var $669b51f08325b4e3$export$2e2bcd8739ae039 = $669b51f08325b4e3$var$SubMenu;
|
|
|
579
381
|
|
|
580
382
|
|
|
581
383
|
|
|
384
|
+
const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)({
|
|
385
|
+
defaultOptions: {
|
|
386
|
+
queries: {
|
|
387
|
+
refetchOnWindowFocus: false
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
const $61ff88fb3f6ee2c8$var$withQueryProvider = (WrappedComponent)=>(props)=>{
|
|
392
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$QueryClientProvider), {
|
|
393
|
+
client: $61ff88fb3f6ee2c8$var$queryClient,
|
|
394
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)(WrappedComponent, {
|
|
395
|
+
...props
|
|
396
|
+
})
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryProvider;
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
582
404
|
|
|
583
405
|
|
|
584
406
|
|
|
@@ -1368,6 +1190,14 @@ var $5723016a5461c1ca$export$2e2bcd8739ae039 = $5723016a5461c1ca$var$PageHeader;
|
|
|
1368
1190
|
|
|
1369
1191
|
|
|
1370
1192
|
|
|
1193
|
+
function $6d5c0212e738499b$export$34e95918366a058e(params, ACA) {
|
|
1194
|
+
if (ACA) params = Object.assign(params, {
|
|
1195
|
+
ACA: ACA,
|
|
1196
|
+
redirect: false
|
|
1197
|
+
});
|
|
1198
|
+
return params;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1371
1201
|
|
|
1372
1202
|
function $eff7d34c30f5a0fc$export$959638e8dca60ce6(facets) {
|
|
1373
1203
|
let facetObj = {};
|
|
@@ -1425,6 +1255,11 @@ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, ACA)
|
|
|
1425
1255
|
|
|
1426
1256
|
|
|
1427
1257
|
|
|
1258
|
+
const $844981eac9b63865$export$eccc29c8d0ff408 = (0, $hgUW1$createContext)({
|
|
1259
|
+
ACA: undefined
|
|
1260
|
+
});
|
|
1261
|
+
|
|
1262
|
+
|
|
1428
1263
|
const $e873081a6e8f024e$export$1040147c129fdde9 = (query)=>{
|
|
1429
1264
|
return /^[a-zA-Z0-9 ]*$/.test(query.trim());
|
|
1430
1265
|
};
|
|
@@ -1450,10 +1285,11 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1450
1285
|
const { rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
|
|
1451
1286
|
defaultSort: 'modified',
|
|
1452
1287
|
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;
|
|
1288
|
+
}, 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
1289
|
const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
|
|
1455
1290
|
const [searchParams] = (0, $hgUW1$useSearchParams)();
|
|
1456
1291
|
const navigate = (0, $hgUW1$useNavigate)();
|
|
1292
|
+
const location = (0, $hgUW1$useLocation)();
|
|
1457
1293
|
// Derive all search state from URL params
|
|
1458
1294
|
const selectedFacets = (0, $hgUW1$useMemo)(()=>{
|
|
1459
1295
|
const parsed = (0, $hgUW1$qs).parse(searchParams.toString());
|
|
@@ -1601,6 +1437,12 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1601
1437
|
noResults,
|
|
1602
1438
|
currentResultNumbers
|
|
1603
1439
|
]);
|
|
1440
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1441
|
+
if (analytics && location.search) onAnalyticsEvent(location);
|
|
1442
|
+
}, [
|
|
1443
|
+
analytics,
|
|
1444
|
+
location.search
|
|
1445
|
+
]);
|
|
1604
1446
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
1605
1447
|
children: [
|
|
1606
1448
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $5723016a5461c1ca$export$2e2bcd8739ae039), {
|
|
@@ -3458,8 +3300,8 @@ function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
|
|
|
3458
3300
|
accessor: column
|
|
3459
3301
|
}));
|
|
3460
3302
|
}
|
|
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));
|
|
3303
|
+
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 })=>{
|
|
3304
|
+
const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner, relativeHomeUrlPrepend: relativeHomeUrlPrepend } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3463
3305
|
const { page: page, setPage: setPage, tableDensity: tableDensity } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
3464
3306
|
const defaultPageSize = 10;
|
|
3465
3307
|
const schema = resource?.schema?.[distribution?.identifier] ?? resource?.schema?.[id];
|
|
@@ -3547,7 +3389,7 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopy
|
|
|
3547
3389
|
children: useDatastoreErrorMessages[resourceErrorStatus].message
|
|
3548
3390
|
}),
|
|
3549
3391
|
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3550
|
-
href:
|
|
3392
|
+
href: `${relativeHomeUrlPrepend}/`,
|
|
3551
3393
|
variation: "solid",
|
|
3552
3394
|
className: "",
|
|
3553
3395
|
children: "Go to home"
|
|
@@ -4397,6 +4239,165 @@ var $85f8ff1ff89899c7$export$2e2bcd8739ae039 = $85f8ff1ff89899c7$var$DataTableTo
|
|
|
4397
4239
|
|
|
4398
4240
|
|
|
4399
4241
|
|
|
4242
|
+
|
|
4243
|
+
|
|
4244
|
+
|
|
4245
|
+
|
|
4246
|
+
|
|
4247
|
+
const $4808982eba3feb88$var$DatasetListSubmenuItem = (props)=>{
|
|
4248
|
+
const { title: title, identifier: identifier, linkClasses: linkClasses } = props;
|
|
4249
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
4250
|
+
className: "dc-c-list-item",
|
|
4251
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
4252
|
+
className: `ds-u-display-flex ds-u-align-items--center ds-u-text-align--left ${linkClasses}`,
|
|
4253
|
+
to: `/dataset/${identifier}`,
|
|
4254
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
4255
|
+
className: "ds-text-heading--md ds-u-margin-left--0",
|
|
4256
|
+
children: title
|
|
4257
|
+
})
|
|
4258
|
+
})
|
|
4259
|
+
}, identifier);
|
|
4260
|
+
};
|
|
4261
|
+
var $4808982eba3feb88$export$2e2bcd8739ae039 = $4808982eba3feb88$var$DatasetListSubmenuItem;
|
|
4262
|
+
|
|
4263
|
+
|
|
4264
|
+
|
|
4265
|
+
|
|
4266
|
+
|
|
4267
|
+
|
|
4268
|
+
const $10bc3aae21fc1572$var$DatasetListSubmenu = ({ rootUrl: rootUrl, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 4, defaultSort: defaultSort = {
|
|
4269
|
+
defaultSort: 'modified',
|
|
4270
|
+
defaultOrder: 'desc'
|
|
4271
|
+
}, subLinkClasses: subLinkClasses })=>{
|
|
4272
|
+
const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
|
|
4273
|
+
const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)({
|
|
4274
|
+
total: 0,
|
|
4275
|
+
startingNumber: 0,
|
|
4276
|
+
endingNumber: 0
|
|
4277
|
+
});
|
|
4278
|
+
const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
|
|
4279
|
+
const [totalItems, setTotalItems] = (0, $hgUW1$useState)(0);
|
|
4280
|
+
const pageSize = defaultPageSize;
|
|
4281
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4282
|
+
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
4283
|
+
else setNoResults(false);
|
|
4284
|
+
}, [
|
|
4285
|
+
totalItems,
|
|
4286
|
+
pageSize
|
|
4287
|
+
]);
|
|
4288
|
+
let params = {
|
|
4289
|
+
sort: defaultSort.defaultSort,
|
|
4290
|
+
['sort-order']: defaultSort.defaultOrder,
|
|
4291
|
+
['page-size']: defaultPageSize
|
|
4292
|
+
};
|
|
4293
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
4294
|
+
queryKey: [
|
|
4295
|
+
"datasets",
|
|
4296
|
+
params
|
|
4297
|
+
],
|
|
4298
|
+
queryFn: ()=>{
|
|
4299
|
+
return (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA), {
|
|
4300
|
+
arrayFormat: 'comma',
|
|
4301
|
+
encode: false
|
|
4302
|
+
})}`);
|
|
4303
|
+
}
|
|
4304
|
+
});
|
|
4305
|
+
// Sync totalItems state with API response data
|
|
4306
|
+
// Moved to useEffect to prevent state updates during render (which can cause infinite loops)
|
|
4307
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4308
|
+
if (data?.data?.total !== undefined && data.data.total !== totalItems) setTotalItems(data.data.total);
|
|
4309
|
+
}, [
|
|
4310
|
+
data?.data?.total
|
|
4311
|
+
]);
|
|
4312
|
+
let submenuItemsCount = 0;
|
|
4313
|
+
if (data) {
|
|
4314
|
+
let resultsCount = Object.keys(data.data.results).length;
|
|
4315
|
+
// For the submenu pager, If there are fewer than 4 dataset items, display the dataset item count, otherwise, show "Viewing 4..".
|
|
4316
|
+
submenuItemsCount = resultsCount > defaultPageSize ? defaultPageSize : resultsCount;
|
|
4317
|
+
}
|
|
4318
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
4319
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
|
|
4320
|
+
className: " dkan-c-site-menu--sub-menu",
|
|
4321
|
+
children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
4322
|
+
className: "ds-u-valign--middle",
|
|
4323
|
+
"aria-valuetext": "Dataset Search loading",
|
|
4324
|
+
role: "status"
|
|
4325
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4326
|
+
children: [
|
|
4327
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
|
|
4328
|
+
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",
|
|
4329
|
+
"data-testid": "submenu-results-list",
|
|
4330
|
+
children: [
|
|
4331
|
+
noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4332
|
+
variation: "error",
|
|
4333
|
+
heading: "No results found."
|
|
4334
|
+
}),
|
|
4335
|
+
data && data.data.results ? Object.keys(data.data.results).map((key)=>{
|
|
4336
|
+
return data.data.results[key];
|
|
4337
|
+
}).map((item)=>{
|
|
4338
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4808982eba3feb88$export$2e2bcd8739ae039), {
|
|
4339
|
+
title: item.title,
|
|
4340
|
+
identifier: item.identifier,
|
|
4341
|
+
linkClasses: subLinkClasses
|
|
4342
|
+
}, item.identifier);
|
|
4343
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4344
|
+
variation: "error",
|
|
4345
|
+
heading: "Could not connect to the API."
|
|
4346
|
+
})
|
|
4347
|
+
]
|
|
4348
|
+
}),
|
|
4349
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4350
|
+
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",
|
|
4351
|
+
children: enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4352
|
+
children: [
|
|
4353
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4354
|
+
className: "",
|
|
4355
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
4356
|
+
className: "ds-u-margin-y--0 ds-u-font-size--sm",
|
|
4357
|
+
"aria-hidden": "true",
|
|
4358
|
+
children: data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4359
|
+
children: [
|
|
4360
|
+
"Viewing ",
|
|
4361
|
+
submenuItemsCount,
|
|
4362
|
+
" of ",
|
|
4363
|
+
data.data.total
|
|
4364
|
+
]
|
|
4365
|
+
})
|
|
4366
|
+
})
|
|
4367
|
+
}),
|
|
4368
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4369
|
+
className: "",
|
|
4370
|
+
children: data && data.data.total > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
4371
|
+
className: "ds-u-padding--0 ds-c-button ds-c-button--ghost dkan-c-header--link",
|
|
4372
|
+
to: `../whats-new`,
|
|
4373
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
4374
|
+
className: "ds-text-heading--md",
|
|
4375
|
+
children: [
|
|
4376
|
+
" ",
|
|
4377
|
+
`View all ${data.data.total} entries`,
|
|
4378
|
+
" "
|
|
4379
|
+
]
|
|
4380
|
+
})
|
|
4381
|
+
})
|
|
4382
|
+
})
|
|
4383
|
+
]
|
|
4384
|
+
})
|
|
4385
|
+
})
|
|
4386
|
+
]
|
|
4387
|
+
})
|
|
4388
|
+
})
|
|
4389
|
+
});
|
|
4390
|
+
};
|
|
4391
|
+
var $10bc3aae21fc1572$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($10bc3aae21fc1572$var$DatasetListSubmenu);
|
|
4392
|
+
|
|
4393
|
+
|
|
4394
|
+
|
|
4395
|
+
|
|
4396
|
+
|
|
4397
|
+
|
|
4398
|
+
|
|
4399
|
+
|
|
4400
|
+
|
|
4400
4401
|
const $5b656f0283afa250$var$SpanOpenAPIVersion = function(system) {
|
|
4401
4402
|
return {
|
|
4402
4403
|
wrapComponents: {
|
|
@@ -7462,7 +7463,8 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
|
|
|
7462
7463
|
customColumns: customColumns,
|
|
7463
7464
|
dataDictionaryBanner: dataDictionaryBanner && displayDataDictionaryTab,
|
|
7464
7465
|
datasetTableControls: !disableTableControls,
|
|
7465
|
-
enableEmptyFilters: enableEmptyFilters
|
|
7466
|
+
enableEmptyFilters: enableEmptyFilters,
|
|
7467
|
+
relativeHomeUrlPrepend: tabHrefPrepend
|
|
7466
7468
|
},
|
|
7467
7469
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {})
|
|
7468
7470
|
}) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|