@civicactions/cmsds-open-data-components 4.1.7-alpha.3 → 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 +255 -219
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +40 -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
|
};
|
|
@@ -2627,13 +2462,12 @@ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, default
|
|
|
2627
2462
|
]);
|
|
2628
2463
|
// keep state in sync
|
|
2629
2464
|
(0, $hgUW1$useEffect)(()=>{
|
|
2630
|
-
if (columnOrder?.length) setCards(columnOrder.map((
|
|
2631
|
-
|
|
2632
|
-
|
|
2465
|
+
if (columnOrder?.length) setCards(columnOrder.map((id)=>columns.find((col)=>col.id === id)) // Get list of cards in order
|
|
2466
|
+
.filter(Boolean) // Filter out any possible undefined/non-matches
|
|
2467
|
+
.map((column)=>({
|
|
2633
2468
|
id: column.id,
|
|
2634
2469
|
visible: column.getIsVisible()
|
|
2635
|
-
};
|
|
2636
|
-
}));
|
|
2470
|
+
})));
|
|
2637
2471
|
}, [
|
|
2638
2472
|
columnOrder
|
|
2639
2473
|
]);
|
|
@@ -2769,13 +2603,12 @@ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, default
|
|
|
2769
2603
|
onClick: ()=>{
|
|
2770
2604
|
// reset to default column order and set all cards to visible
|
|
2771
2605
|
// do not save this to the table state until the "Save" button is clicked
|
|
2772
|
-
setCards(defaultColumnOrder.map((
|
|
2773
|
-
|
|
2774
|
-
|
|
2606
|
+
setCards(defaultColumnOrder.map((id)=>cards.find((c)=>c.id === id)) // Get list of cards in order
|
|
2607
|
+
.filter(Boolean) // Filter out any possible undefined/non-matches
|
|
2608
|
+
.map((card)=>({
|
|
2775
2609
|
...card,
|
|
2776
2610
|
visible: true
|
|
2777
|
-
};
|
|
2778
|
-
}));
|
|
2611
|
+
})));
|
|
2779
2612
|
},
|
|
2780
2613
|
children: "Reset Columns"
|
|
2781
2614
|
})
|
|
@@ -3468,7 +3301,7 @@ function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
|
|
|
3468
3301
|
}));
|
|
3469
3302
|
}
|
|
3470
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 })=>{
|
|
3471
|
-
const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3304
|
+
const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner, relativeHomeUrlPrepend: relativeHomeUrlPrepend } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3472
3305
|
const { page: page, setPage: setPage, tableDensity: tableDensity } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
3473
3306
|
const defaultPageSize = 10;
|
|
3474
3307
|
const schema = resource?.schema?.[distribution?.identifier] ?? resource?.schema?.[id];
|
|
@@ -3481,7 +3314,18 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopy
|
|
|
3481
3314
|
}, {
|
|
3482
3315
|
encode: true
|
|
3483
3316
|
})}&format=csv`;
|
|
3484
|
-
|
|
3317
|
+
const useDatastoreErrorMessages = {
|
|
3318
|
+
400: {
|
|
3319
|
+
title: 'Data unavailable',
|
|
3320
|
+
message: 'This data is not available for preview at this time. Please try again later.'
|
|
3321
|
+
},
|
|
3322
|
+
500: {
|
|
3323
|
+
title: 'Something went wrong',
|
|
3324
|
+
message: 'Something went wrong on our end. Please try again later.'
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
// Data loaded successfully
|
|
3328
|
+
if (!resource.error && Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
3485
3329
|
children: [
|
|
3486
3330
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3487
3331
|
className: isModal ? 'dkan-datatable-fullscreen-mode' : '',
|
|
@@ -3532,7 +3376,28 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, showCopy
|
|
|
3532
3376
|
})
|
|
3533
3377
|
]
|
|
3534
3378
|
});
|
|
3535
|
-
else
|
|
3379
|
+
else if (resource.error && !resource.loading) {
|
|
3380
|
+
const resourceErrorStatus = resource.error.status in useDatastoreErrorMessages ? resource.error.status : 500;
|
|
3381
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3382
|
+
children: [
|
|
3383
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
3384
|
+
className: "ds-text-heading--lg ds-u-margin--0 ds-u-color--primary",
|
|
3385
|
+
children: useDatastoreErrorMessages[resourceErrorStatus].title
|
|
3386
|
+
}),
|
|
3387
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
3388
|
+
className: "ds-u-padding-bottom--2 ds-u-margin-bottom--7",
|
|
3389
|
+
children: useDatastoreErrorMessages[resourceErrorStatus].message
|
|
3390
|
+
}),
|
|
3391
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3392
|
+
href: `${relativeHomeUrlPrepend}/`,
|
|
3393
|
+
variation: "solid",
|
|
3394
|
+
className: "",
|
|
3395
|
+
children: "Go to home"
|
|
3396
|
+
})
|
|
3397
|
+
]
|
|
3398
|
+
});
|
|
3399
|
+
// Data loading
|
|
3400
|
+
} else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
3536
3401
|
"aria-valuetext": "Dataset loading",
|
|
3537
3402
|
role: "status",
|
|
3538
3403
|
className: "ds-u-margin--3"
|
|
@@ -4374,6 +4239,165 @@ var $85f8ff1ff89899c7$export$2e2bcd8739ae039 = $85f8ff1ff89899c7$var$DataTableTo
|
|
|
4374
4239
|
|
|
4375
4240
|
|
|
4376
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
|
+
|
|
4377
4401
|
const $5b656f0283afa250$var$SpanOpenAPIVersion = function(system) {
|
|
4378
4402
|
return {
|
|
4379
4403
|
wrapComponents: {
|
|
@@ -6041,13 +6065,23 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
6041
6065
|
}
|
|
6042
6066
|
// Change whether distribution API or dataset API is used based on option
|
|
6043
6067
|
const queryID = useDatasetAPI && datasetID ? `${datasetID}/0` : id;
|
|
6068
|
+
async function fetchJson(url) {
|
|
6069
|
+
const res = await fetch(url);
|
|
6070
|
+
const body = await res.json().catch(()=>({}));
|
|
6071
|
+
if (!res.ok) {
|
|
6072
|
+
const err = new Error(body.message || body.error || res.statusText);
|
|
6073
|
+
err.status = res.status;
|
|
6074
|
+
throw err;
|
|
6075
|
+
}
|
|
6076
|
+
return body;
|
|
6077
|
+
}
|
|
6044
6078
|
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
6045
6079
|
queryKey: [
|
|
6046
6080
|
"datastore" + id + paramsString
|
|
6047
6081
|
],
|
|
6048
6082
|
queryFn: ()=>{
|
|
6049
6083
|
setCount(null);
|
|
6050
|
-
return
|
|
6084
|
+
return fetchJson(`${rootUrl}/datastore/query/${queryID}?${paramsString}`);
|
|
6051
6085
|
},
|
|
6052
6086
|
enabled: enabled
|
|
6053
6087
|
});
|
|
@@ -6061,7 +6095,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
6061
6095
|
count: true,
|
|
6062
6096
|
schema: true
|
|
6063
6097
|
};
|
|
6064
|
-
return
|
|
6098
|
+
return fetchJson(`${rootUrl}/datastore/query/${queryID}?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(unfilteredParams, ACA))}`);
|
|
6065
6099
|
}
|
|
6066
6100
|
});
|
|
6067
6101
|
(0, $hgUW1$useEffect)(()=>{
|
|
@@ -6084,6 +6118,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
6084
6118
|
]);
|
|
6085
6119
|
return {
|
|
6086
6120
|
loading: enabled ? isPending : false,
|
|
6121
|
+
error: error,
|
|
6087
6122
|
values: values,
|
|
6088
6123
|
count: count,
|
|
6089
6124
|
columns: columns,
|
|
@@ -7428,7 +7463,8 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
|
|
|
7428
7463
|
customColumns: customColumns,
|
|
7429
7464
|
dataDictionaryBanner: dataDictionaryBanner && displayDataDictionaryTab,
|
|
7430
7465
|
datasetTableControls: !disableTableControls,
|
|
7431
|
-
enableEmptyFilters: enableEmptyFilters
|
|
7466
|
+
enableEmptyFilters: enableEmptyFilters,
|
|
7467
|
+
relativeHomeUrlPrepend: tabHrefPrepend
|
|
7432
7468
|
},
|
|
7433
7469
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {})
|
|
7434
7470
|
}) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|