@civicactions/cmsds-open-data-components 4.1.6 → 4.1.7-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 +197 -203
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +21 -18
- 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
|
};
|
|
@@ -4367,6 +4202,165 @@ var $85f8ff1ff89899c7$export$2e2bcd8739ae039 = $85f8ff1ff89899c7$var$DataTableTo
|
|
|
4367
4202
|
|
|
4368
4203
|
|
|
4369
4204
|
|
|
4205
|
+
|
|
4206
|
+
|
|
4207
|
+
|
|
4208
|
+
|
|
4209
|
+
|
|
4210
|
+
const $4808982eba3feb88$var$DatasetListSubmenuItem = (props)=>{
|
|
4211
|
+
const { title: title, identifier: identifier, linkClasses: linkClasses } = props;
|
|
4212
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
4213
|
+
className: "dc-c-list-item",
|
|
4214
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
4215
|
+
className: `ds-u-display-flex ds-u-align-items--center ds-u-text-align--left ${linkClasses}`,
|
|
4216
|
+
to: `/dataset/${identifier}`,
|
|
4217
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
4218
|
+
className: "ds-text-heading--md ds-u-margin-left--0",
|
|
4219
|
+
children: title
|
|
4220
|
+
})
|
|
4221
|
+
})
|
|
4222
|
+
}, identifier);
|
|
4223
|
+
};
|
|
4224
|
+
var $4808982eba3feb88$export$2e2bcd8739ae039 = $4808982eba3feb88$var$DatasetListSubmenuItem;
|
|
4225
|
+
|
|
4226
|
+
|
|
4227
|
+
|
|
4228
|
+
|
|
4229
|
+
|
|
4230
|
+
|
|
4231
|
+
const $10bc3aae21fc1572$var$DatasetListSubmenu = ({ rootUrl: rootUrl, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 4, defaultSort: defaultSort = {
|
|
4232
|
+
defaultSort: 'modified',
|
|
4233
|
+
defaultOrder: 'desc'
|
|
4234
|
+
}, subLinkClasses: subLinkClasses })=>{
|
|
4235
|
+
const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
|
|
4236
|
+
const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)({
|
|
4237
|
+
total: 0,
|
|
4238
|
+
startingNumber: 0,
|
|
4239
|
+
endingNumber: 0
|
|
4240
|
+
});
|
|
4241
|
+
const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
|
|
4242
|
+
const [totalItems, setTotalItems] = (0, $hgUW1$useState)(0);
|
|
4243
|
+
const pageSize = defaultPageSize;
|
|
4244
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4245
|
+
if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
|
|
4246
|
+
else setNoResults(false);
|
|
4247
|
+
}, [
|
|
4248
|
+
totalItems,
|
|
4249
|
+
pageSize
|
|
4250
|
+
]);
|
|
4251
|
+
let params = {
|
|
4252
|
+
sort: defaultSort.defaultSort,
|
|
4253
|
+
['sort-order']: defaultSort.defaultOrder,
|
|
4254
|
+
['page-size']: defaultPageSize
|
|
4255
|
+
};
|
|
4256
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
4257
|
+
queryKey: [
|
|
4258
|
+
"datasets",
|
|
4259
|
+
params
|
|
4260
|
+
],
|
|
4261
|
+
queryFn: ()=>{
|
|
4262
|
+
return (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA), {
|
|
4263
|
+
arrayFormat: 'comma',
|
|
4264
|
+
encode: false
|
|
4265
|
+
})}`);
|
|
4266
|
+
}
|
|
4267
|
+
});
|
|
4268
|
+
// Sync totalItems state with API response data
|
|
4269
|
+
// Moved to useEffect to prevent state updates during render (which can cause infinite loops)
|
|
4270
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
4271
|
+
if (data?.data?.total !== undefined && data.data.total !== totalItems) setTotalItems(data.data.total);
|
|
4272
|
+
}, [
|
|
4273
|
+
data?.data?.total
|
|
4274
|
+
]);
|
|
4275
|
+
let submenuItemsCount = 0;
|
|
4276
|
+
if (data) {
|
|
4277
|
+
let resultsCount = Object.keys(data.data.results).length;
|
|
4278
|
+
// For the submenu pager, If there are fewer than 4 dataset items, display the dataset item count, otherwise, show "Viewing 4..".
|
|
4279
|
+
submenuItemsCount = resultsCount > defaultPageSize ? defaultPageSize : resultsCount;
|
|
4280
|
+
}
|
|
4281
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
4282
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
|
|
4283
|
+
className: " dkan-c-site-menu--sub-menu",
|
|
4284
|
+
children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
4285
|
+
className: "ds-u-valign--middle",
|
|
4286
|
+
"aria-valuetext": "Dataset Search loading",
|
|
4287
|
+
role: "status"
|
|
4288
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4289
|
+
children: [
|
|
4290
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
|
|
4291
|
+
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",
|
|
4292
|
+
"data-testid": "submenu-results-list",
|
|
4293
|
+
children: [
|
|
4294
|
+
noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4295
|
+
variation: "error",
|
|
4296
|
+
heading: "No results found."
|
|
4297
|
+
}),
|
|
4298
|
+
data && data.data.results ? Object.keys(data.data.results).map((key)=>{
|
|
4299
|
+
return data.data.results[key];
|
|
4300
|
+
}).map((item)=>{
|
|
4301
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4808982eba3feb88$export$2e2bcd8739ae039), {
|
|
4302
|
+
title: item.title,
|
|
4303
|
+
identifier: item.identifier,
|
|
4304
|
+
linkClasses: subLinkClasses
|
|
4305
|
+
}, item.identifier);
|
|
4306
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
4307
|
+
variation: "error",
|
|
4308
|
+
heading: "Could not connect to the API."
|
|
4309
|
+
})
|
|
4310
|
+
]
|
|
4311
|
+
}),
|
|
4312
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4313
|
+
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",
|
|
4314
|
+
children: enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4315
|
+
children: [
|
|
4316
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4317
|
+
className: "",
|
|
4318
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
4319
|
+
className: "ds-u-margin-y--0 ds-u-font-size--sm",
|
|
4320
|
+
"aria-hidden": "true",
|
|
4321
|
+
children: data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
4322
|
+
children: [
|
|
4323
|
+
"Viewing ",
|
|
4324
|
+
submenuItemsCount,
|
|
4325
|
+
" of ",
|
|
4326
|
+
data.data.total
|
|
4327
|
+
]
|
|
4328
|
+
})
|
|
4329
|
+
})
|
|
4330
|
+
}),
|
|
4331
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
4332
|
+
className: "",
|
|
4333
|
+
children: data && data.data.total > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
|
|
4334
|
+
className: "ds-u-padding--0 ds-c-button ds-c-button--ghost dkan-c-header--link",
|
|
4335
|
+
to: `../whats-new`,
|
|
4336
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
4337
|
+
className: "ds-text-heading--md",
|
|
4338
|
+
children: [
|
|
4339
|
+
" ",
|
|
4340
|
+
`View all ${data.data.total} entries`,
|
|
4341
|
+
" "
|
|
4342
|
+
]
|
|
4343
|
+
})
|
|
4344
|
+
})
|
|
4345
|
+
})
|
|
4346
|
+
]
|
|
4347
|
+
})
|
|
4348
|
+
})
|
|
4349
|
+
]
|
|
4350
|
+
})
|
|
4351
|
+
})
|
|
4352
|
+
});
|
|
4353
|
+
};
|
|
4354
|
+
var $10bc3aae21fc1572$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($10bc3aae21fc1572$var$DatasetListSubmenu);
|
|
4355
|
+
|
|
4356
|
+
|
|
4357
|
+
|
|
4358
|
+
|
|
4359
|
+
|
|
4360
|
+
|
|
4361
|
+
|
|
4362
|
+
|
|
4363
|
+
|
|
4370
4364
|
const $5b656f0283afa250$var$SpanOpenAPIVersion = function(system) {
|
|
4371
4365
|
return {
|
|
4372
4366
|
wrapComponents: {
|