@civicactions/cmsds-open-data-components 3.9.2 → 3.10.0-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.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, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Dropdown as $hgUW1$Dropdown, Choice as $hgUW1$Choice, Pagination as $hgUW1$Pagination, Badge as $hgUW1$Badge, 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} from "@cmsgov/design-system";
3
+ import {Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Button as $hgUW1$Button, CloseIconThin as $hgUW1$CloseIconThin, ArrowIcon as $hgUW1$ArrowIcon, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Dropdown as $hgUW1$Dropdown, Choice as $hgUW1$Choice, Pagination as $hgUW1$Pagination, 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, 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, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams} from "react-router-dom";
5
+ import {NavLink as $hgUW1$NavLink, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate} 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";
@@ -275,6 +275,7 @@ var $11500a65bd7d9cf1$export$2e2bcd8739ae039 = $11500a65bd7d9cf1$var$HeaderConte
275
275
 
276
276
 
277
277
 
278
+
278
279
  const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)({
279
280
  defaultOptions: {
280
281
  queries: {
@@ -298,25 +299,44 @@ var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryPr
298
299
 
299
300
 
300
301
 
302
+
301
303
  const $4808982eba3feb88$var$DatasetListSubmenuItem = (props)=>{
302
- const { title: title, identifier: identifier, linkClasses: linkClasses } = props;
304
+ const desktop = (0, $hgUW1$useMediaQuery)({
305
+ minWidth: 1024
306
+ });
307
+ const { title: title, identifier: identifier, paginationEnabled: paginationEnabled, dataDictionaryLinks: dataDictionaryLinks } = props;
308
+ let linkContainerClasses = "ds-u-margin-bottom--2";
309
+ if (dataDictionaryLinks) linkContainerClasses += " ds-l-col--6 ds-u-padding-right--0";
310
+ else linkContainerClasses += " ds-l-col--auto ds-u-padding-left--0";
311
+ let linkClasses = "ds-u-display--block ds-u-text-align--left";
312
+ if (desktop) {
313
+ linkContainerClasses = "ds-u-padding-x--0";
314
+ linkClasses += " ds-l-col--4 ds-l-md-col--auto";
315
+ }
303
316
  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
317
+ className: "dc-c-list-item ds-u-padding-top--4",
318
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
319
+ className: `dc-c-searchlist-item ${paginationEnabled ? "ds-u-border-top--1" : "ds-u-border-bottom--1 ds-u-padding-bottom--3"}`,
320
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
321
+ className: "ds-l-row ds-u-align-items--start",
322
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
323
+ "aria-describedby": `dataset-${identifier}-updated-date`,
324
+ to: `/dataset/${identifier}`,
325
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
326
+ className: "ds-l-col--12 ds-text-heading--md",
327
+ children: title
328
+ })
329
+ })
311
330
  })
312
331
  })
313
- }, identifier);
332
+ });
314
333
  };
315
334
  var $4808982eba3feb88$export$2e2bcd8739ae039 = $4808982eba3feb88$var$DatasetListSubmenuItem;
316
335
 
317
336
 
318
337
 
319
338
 
339
+
320
340
  function $6d5c0212e738499b$export$34e95918366a058e(params, ACA) {
321
341
  if (ACA) params = Object.assign(params, {
322
342
  ACA: ACA,
@@ -326,36 +346,136 @@ function $6d5c0212e738499b$export$34e95918366a058e(params, ACA) {
326
346
  }
327
347
 
328
348
 
349
+ function $eff7d34c30f5a0fc$export$959638e8dca60ce6(facets) {
350
+ let facetObj = {};
351
+ if (facets) {
352
+ facets.forEach((f)=>{
353
+ if (facetObj[f.type]) facetObj[f.type] = [
354
+ ...facetObj[f.type],
355
+ f
356
+ ];
357
+ else facetObj[f.type] = [
358
+ f
359
+ ];
360
+ });
361
+ // sort facets descending by int value, put non int last
362
+ if (facetObj.keyword) facetObj.keyword.sort((a, b)=>{
363
+ if (Number(a.name) && Number(b.name)) return Number(b.name) - Number(a.name);
364
+ });
365
+ return facetObj;
366
+ }
367
+ }
368
+ function $eff7d34c30f5a0fc$export$60ec7cc1d341a524(searchParams, defaultSortOptions) {
369
+ const params = (0, $hgUW1$qs).parse(searchParams, {
370
+ ignoreQueryPrefix: true
371
+ });
372
+ let themes = params.theme;
373
+ let keywords = params.keyword;
374
+ return {
375
+ page: params.page,
376
+ sort: !params.sort ? defaultSortOptions.defaultSort : params.sort,
377
+ sortOrder: !params.sortOrder ? defaultSortOptions.defaultOrder : params.sortOrder,
378
+ fulltext: params.fulltext,
379
+ selectedFacets: {
380
+ theme: themes ? themes : [],
381
+ keyword: keywords ? keywords : []
382
+ }
383
+ };
384
+ }
385
+ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, ACA) {
386
+ const { fulltext: fulltext, selectedFacets: selectedFacets, sort: sort, sortOrder: sortOrder, page: page, pageSize: pageSize } = options;
387
+ let params = {
388
+ fulltext: fulltext ? fulltext : undefined,
389
+ ...selectedFacets,
390
+ sort: sort ? sort : undefined,
391
+ ["sort-order"]: sortOrder ? sortOrder : undefined,
392
+ page: page !== 1 ? page : undefined,
393
+ ["page-size"]: pageSize !== 10 ? pageSize : undefined
394
+ };
395
+ return await (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA), {
396
+ arrayFormat: "comma",
397
+ encode: false
398
+ })}`);
399
+ }
400
+
401
+
402
+
329
403
 
330
404
  const $844981eac9b63865$export$eccc29c8d0ff408 = (0, $hgUW1$createContext)({
331
405
  ACA: undefined
332
406
  });
333
407
 
334
408
 
335
- const $10bc3aae21fc1572$var$DatasetListSubmenu = ({ rootUrl: rootUrl, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 4, defaultSort: defaultSort = {
336
- defaultSort: "modified",
337
- defaultOrder: "desc"
338
- }, subLinkClasses: subLinkClasses })=>{
409
+ const $9384a736d4d6f425$var$DatasetListSubmenu = (props)=>{
410
+ const { rootUrl: rootUrl, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 3, defaultSort: defaultSort = {
411
+ defaultSort: "modified",
412
+ defaultOrder: "desc"
413
+ }, dataDictionaryLinks: dataDictionaryLinks = false } = props;
339
414
  const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
415
+ const defaultSortBy = "";
416
+ const defaultSortOrder = "";
417
+ const defaultPage = 1;
418
+ const location = (0, $hgUW1$useLocation)();
419
+ const transformedParams = (0, $eff7d34c30f5a0fc$export$60ec7cc1d341a524)(location.search, defaultSort);
340
420
  const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)({
341
421
  total: 0,
342
422
  startingNumber: 0,
343
423
  endingNumber: 0
344
424
  });
345
425
  const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
426
+ const [announcementText, setAnnouncementText] = (0, $hgUW1$useState)("");
427
+ let [searchParams, setSearchParams] = (0, $hgUW1$useSearchParams)();
346
428
  const [totalItems, setTotalItems] = (0, $hgUW1$useState)(0);
429
+ const [page, setPage] = (0, $hgUW1$useState)(transformedParams.page ? transformedParams.page : defaultPage);
430
+ const [sort, setSort] = (0, $hgUW1$useState)(transformedParams.sort ? transformedParams.sort : defaultSort ? defaultSort.defaultSort : defaultSortBy);
431
+ const [sortOrder, setSortOrder] = (0, $hgUW1$useState)(transformedParams.sortOrder ? transformedParams.sortOrder : defaultSort ? defaultSort.defaultOrder : defaultSortOrder);
347
432
  const pageSize = defaultPageSize;
348
433
  (0, $hgUW1$useEffect)(()=>{
434
+ // Update browser URL with current search params
435
+ const params = buildSearchParams(true);
436
+ const url = new URL(window.location.href);
437
+ window.history.pushState({}, "", `${url.origin}${url.pathname}${params}`);
438
+ const baseNumber = Number(totalItems) > 0 ? 1 : 0;
439
+ const startingNumber = baseNumber + (Number(pageSize) * Number(page) - Number(pageSize));
440
+ const endingNumber = Number(pageSize) * Number(page);
441
+ setCurrentResultNumbers({
442
+ total: Number(totalItems),
443
+ startingNumber: Number(totalItems) >= startingNumber ? startingNumber : 0,
444
+ endingNumber: Number(totalItems) < endingNumber ? Number(totalItems) : endingNumber
445
+ });
446
+ setTimeout(()=>{
447
+ setAnnouncementText(`Showing ${startingNumber} to ${endingNumber} of ${totalItems} datasets`);
448
+ }, 100);
349
449
  if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
350
450
  else setNoResults(false);
351
451
  }, [
352
452
  totalItems,
353
- pageSize
453
+ pageSize,
454
+ page
455
+ ]);
456
+ (0, $hgUW1$useEffect)(()=>{
457
+ var params = buildSearchParams(true);
458
+ if (params !== location.search) setSearchParams(params);
459
+ }, [
460
+ page,
461
+ sort,
462
+ sortOrder
354
463
  ]);
464
+ function buildSearchParams(includePage) {
465
+ let newParams = {};
466
+ if (Number(page) !== 1 && includePage) newParams.page = page;
467
+ if (sort !== defaultSort.defaultSort) newParams.sort = sort;
468
+ if (sortOrder !== defaultSort.defaultOrder) newParams.sortOrder = sortOrder;
469
+ return (0, $hgUW1$qs).stringify(newParams, {
470
+ addQueryPrefix: includePage,
471
+ encode: true
472
+ });
473
+ }
355
474
  let params = {
356
- sort: defaultSort.defaultSort,
357
- ["sort-order"]: defaultSort.defaultOrder,
358
- ["page-size"]: defaultPageSize
475
+ sort: sort ? sort : undefined,
476
+ ["sort-order"]: sortOrder ? sortOrder : undefined,
477
+ page: page !== 1 ? page : undefined,
478
+ ["page-size"]: pageSize !== 10 ? pageSize : undefined
359
479
  };
360
480
  const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
361
481
  queryKey: [
@@ -369,97 +489,79 @@ const $10bc3aae21fc1572$var$DatasetListSubmenu = ({ rootUrl: rootUrl, enablePagi
369
489
  })}`);
370
490
  }
371
491
  });
372
- let submenuItemsCount = 0;
373
- if (data) {
374
- if (data.data.total && totalItems !== data.data.total) setTotalItems(data.data.total);
375
- let resultsCount = Object.keys(data.data.results).length;
376
- // For the submenu pager, If there are fewer than 4 dataset items, display the dataset item count, otherwise, show "Viewing 4..".
377
- submenuItemsCount = resultsCount > defaultPageSize ? defaultPageSize : resultsCount;
378
- }
492
+ if (data && data.data.total && totalItems != data.data.total) setTotalItems(data.data.total);
379
493
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
380
494
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
381
- className: " dkan-c-site-menu--sub-menu",
382
- children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
383
- className: "ds-u-valign--middle",
384
- "aria-valuetext": "Dataset Search loading",
385
- role: "status"
386
- }) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
387
- children: [
388
- /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
389
- 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",
390
- "data-testid": "submenu-results-list",
495
+ className: "ds-l-container",
496
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
497
+ className: "ds-l-row ds-u-padding-top--4",
498
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
499
+ className: "ds-l-col--12",
500
+ children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
501
+ className: "ds-u-valign--middle",
502
+ "aria-valuetext": "Dataset Search loading",
503
+ role: "status"
504
+ }) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
391
505
  children: [
392
- noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
393
- variation: "error",
394
- heading: "No results found."
506
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
507
+ children: "Test submenu list of new datasets."
395
508
  }),
396
- data && data.data.results ? Object.keys(data.data.results).map((key)=>{
397
- return data.data.results[key];
398
- }).map((item)=>{
399
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4808982eba3feb88$export$2e2bcd8739ae039), {
400
- title: item.title,
401
- identifier: item.identifier,
402
- linkClasses: subLinkClasses
403
- }, item.identifier);
404
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
405
- variation: "error",
406
- heading: "Could not connect to the API."
407
- })
408
- ]
409
- }),
410
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
411
- 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",
412
- children: enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
413
- children: [
414
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
415
- className: "",
509
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
510
+ className: "dc-dataset-search-list ds-u-padding--0 ds-u-margin-top--0 ds-u-margin-bottom--4 ds-u-display--block",
511
+ "data-testid": "results-list",
512
+ children: [
513
+ noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
514
+ variation: "error",
515
+ heading: "No results found."
516
+ }),
517
+ data && data.data.results ? Object.keys(data.data.results).map((key)=>{
518
+ return data.data.results[key];
519
+ }).map((item)=>{
520
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $4808982eba3feb88$export$2e2bcd8739ae039), {
521
+ title: item.title,
522
+ identifier: item.identifier,
523
+ paginationEnabled: enablePagination,
524
+ dataDictionaryLinks: dataDictionaryLinks
525
+ }, item.identifier);
526
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
527
+ variation: "error",
528
+ heading: "Could not connect to the API."
529
+ })
530
+ ]
531
+ }),
532
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
533
+ className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--end ds-u-flex-wrap--reverse ds-u-sm-flex-wrap--wrap",
534
+ children: enablePagination && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
535
+ className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--8",
416
536
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
417
- className: "ds-u-margin-y--0 ds-u-font-size--sm",
537
+ className: "ds-u-margin-y--0",
418
538
  "aria-hidden": "true",
419
- children: data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
539
+ children: currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
420
540
  children: [
421
541
  "Viewing ",
422
- submenuItemsCount,
542
+ currentResultNumbers.endingNumber,
423
543
  " of ",
424
544
  data.data.total
425
545
  ]
426
546
  })
427
547
  })
428
- }),
429
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
430
- className: "",
431
- children: data && data.data.total > 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Link), {
432
- className: "ds-u-padding--0 ds-c-button ds-c-button--ghost dkan-c-header--link",
433
- to: `../whats-new`,
434
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
435
- className: "ds-text-heading--md",
436
- children: [
437
- " ",
438
- `View all ${data.data.total} entries`,
439
- " "
440
- ]
441
- })
442
- })
443
548
  })
444
- ]
445
- })
549
+ })
550
+ ]
446
551
  })
447
- ]
552
+ })
448
553
  })
449
554
  })
450
555
  });
451
556
  };
452
- var $10bc3aae21fc1572$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($10bc3aae21fc1572$var$DatasetListSubmenu);
557
+ var $9384a736d4d6f425$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($9384a736d4d6f425$var$DatasetListSubmenu);
453
558
 
454
559
 
455
560
 
456
561
 
457
562
 
458
-
459
-
460
- const $6d0cf21faac6a2dd$var$SubMenuStaticList = ({ submenuArray: submenuArray, subLinkClasses: subLinkClasses, setIsExpanded: setIsExpanded })=>{
461
- // Render a static list of submenu items as listed in the assets/menu.jsx file.
462
- let submenuItems = submenuArray.map((s)=>{
563
+ const $4f153ca537d853e5$var$SubMenuStaticItem = (submenuArray, subLinkClasses)=>// @todo: Move into a separate component
564
+ submenuArray.map((s)=>{
463
565
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
464
566
  children: s.external || s.drupalPage ? /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
465
567
  href: s.url,
@@ -473,7 +575,7 @@ const $6d0cf21faac6a2dd$var$SubMenuStaticList = ({ submenuArray: submenuArray, s
473
575
  }) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$NavLink), {
474
576
  to: s.url,
475
577
  className: `ds-u-display-flex ds-u-align-items--center ${subLinkClasses}`,
476
- onClick: ()=>setIsExpanded((prev)=>!prev),
578
+ onClick: ()=>setIsExpanded(!isExpanded),
477
579
  children: [
478
580
  s.icon ?? null,
479
581
  /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
@@ -483,16 +585,19 @@ const $6d0cf21faac6a2dd$var$SubMenuStaticList = ({ submenuArray: submenuArray, s
483
585
  })
484
586
  }, s.id);
485
587
  });
486
- return /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
487
- className: `dkan-c-site-menu--sub-menu`,
488
- children: submenuItems
588
+ const $4f153ca537d853e5$var$SubMenuDynamicList = ({ rootUrl: rootUrl, location: location })=>{
589
+ // @todo: If we don't need subLinkClasses, call the DatasetListSubmenu component directly.
590
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $9384a736d4d6f425$export$2e2bcd8739ae039), {
591
+ rootUrl: rootUrl,
592
+ location: location,
593
+ formClassName: "ds-u-display--flex ds-u-align-items--end ds-u-justify-content--between ds-u-margin-bottom--2",
594
+ fulltextLabelClassName: "",
595
+ fulltextPlaceholder: "",
596
+ fulltextLabel: "Dataset submenu List"
489
597
  });
490
598
  };
491
- var $6d0cf21faac6a2dd$export$2e2bcd8739ae039 = $6d0cf21faac6a2dd$var$SubMenuStaticList;
492
-
493
-
494
599
  const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, subLinkClasses: subLinkClasses, wrapLabel: wrapLabel = true })=>{
495
- const [isExpanded, setIsExpanded] = (0, $hgUW1$useState)(false);
600
+ const [isExpanded1, setIsExpanded1] = (0, $hgUW1$useState)(false);
496
601
  const headerContext = (0, $hgUW1$react).useContext((0, $11500a65bd7d9cf1$export$2e2bcd8739ae039));
497
602
  const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
498
603
  children: link.label
@@ -502,10 +607,10 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
502
607
  let currentMenu = null;
503
608
  if (menu.current) currentMenu = menu.current;
504
609
  function handleClickOutside(event) {
505
- if (currentMenu && !currentMenu.contains(event.target)) setIsExpanded(false);
610
+ if (currentMenu && !currentMenu.contains(event.target)) setIsExpanded1(false);
506
611
  }
507
612
  function handleFocusOut(event) {
508
- if (currentMenu && !currentMenu.contains(event.relatedTarget)) setIsExpanded(false);
613
+ if (currentMenu && !currentMenu.contains(event.relatedTarget)) setIsExpanded1(false);
509
614
  }
510
615
  document.addEventListener("mousedown", handleClickOutside);
511
616
  currentMenu?.addEventListener("focusout", handleFocusOut);
@@ -514,26 +619,15 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
514
619
  if (currentMenu) currentMenu.removeEventListener("focusout", handleFocusOut);
515
620
  };
516
621
  }, [
517
- isExpanded
622
+ isExpanded1
518
623
  ]);
519
624
  let submenuBlock;
520
625
  if (link.submenu) {
521
- if (Array.isArray(link.submenu)) submenuBlock = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6d0cf21faac6a2dd$export$2e2bcd8739ae039), {
522
- submenuArray: link.submenu,
523
- subLinkClasses: subLinkClasses,
524
- setIsExpanded: setIsExpanded
525
- });
526
- else if (/*#__PURE__*/ (0, $hgUW1$react).isValidElement(link.submenu)) {
527
- const { rootUrl: rootUrl, location: location } = link.submenu.props;
528
- submenuBlock = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $10bc3aae21fc1572$export$2e2bcd8739ae039), {
529
- location: location,
530
- rootUrl: rootUrl,
531
- subLinkClasses: subLinkClasses
532
- });
533
- }
626
+ if (Array.isArray(link.submenu)) submenuBlock = $4f153ca537d853e5$var$SubMenuStaticItem(link.submenu, subLinkClasses);
627
+ else if (/*#__PURE__*/ (0, $hgUW1$react).isValidElement(link.submenu)) submenuBlock = $4f153ca537d853e5$var$SubMenuDynamicList(link.submenu, subLinkClasses);
534
628
  }
535
629
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
536
- className: `dkan-c-nav-submenu has-submenu${isExpanded ? " open" : ""}`,
630
+ className: `dkan-c-nav-submenu has-submenu${isExpanded1 ? " open" : ""}`,
537
631
  ref: menu,
538
632
  children: [
539
633
  /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
@@ -541,20 +635,23 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
541
635
  onDark: headerContext.onDark,
542
636
  className: `${linkClasses}`,
543
637
  "aria-haspopup": "true",
544
- "aria-expanded": isExpanded,
638
+ "aria-expanded": isExpanded1,
545
639
  onClick: (e)=>{
546
640
  e.preventDefault();
547
- setIsExpanded(!isExpanded);
641
+ setIsExpanded1(!isExpanded1);
548
642
  },
549
643
  children: [
550
644
  innerHtml,
551
645
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$ArrowIcon), {
552
646
  className: "ds-u-margin-left--1",
553
- direction: isExpanded ? "down" : "right"
647
+ direction: isExpanded1 ? "down" : "right"
554
648
  })
555
649
  ]
556
650
  }),
557
- submenuBlock
651
+ /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
652
+ className: "dkan-c-site-menu--sub-menu",
653
+ children: submenuBlock
654
+ })
558
655
  ]
559
656
  });
560
657
  };
@@ -1665,7 +1762,6 @@ var $52c6454cae137465$export$2e2bcd8739ae039 = $52c6454cae137465$var$DatasetSear
1665
1762
 
1666
1763
 
1667
1764
 
1668
-
1669
1765
  const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
1670
1766
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1671
1767
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
@@ -2281,6 +2377,67 @@ var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTH
2281
2377
 
2282
2378
 
2283
2379
 
2380
+ const $43a30d745a7bbc86$var$DataTableContext = /*#__PURE__*/ (0, $hgUW1$createContext)({
2381
+ id: null
2382
+ });
2383
+ var $43a30d745a7bbc86$export$2e2bcd8739ae039 = $43a30d745a7bbc86$var$DataTableContext;
2384
+
2385
+
2386
+
2387
+
2388
+
2389
+ // Create a defaults object for reusability
2390
+ const $ee0d4d4f34048447$var$DataTableActionsContextDefaults = {
2391
+ columnOrder: [],
2392
+ setColumnOrder: ()=>{},
2393
+ columnVisibility: {},
2394
+ setColumnVisibility: ()=>{},
2395
+ page: 1,
2396
+ setPage: ()=>{},
2397
+ tableDensity: "normal",
2398
+ setTableDensity: ()=>{}
2399
+ };
2400
+ const $ee0d4d4f34048447$export$f814ea079e65d8fe = /*#__PURE__*/ (0, $hgUW1$createContext)($ee0d4d4f34048447$var$DataTableActionsContextDefaults);
2401
+ // Define our reusable provider component
2402
+ const $ee0d4d4f34048447$var$DataTableActionsProvider = ({ children: children })=>{
2403
+ // Set up all of the state
2404
+ const { id: id, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
2405
+ // a wrapper component to keep column state synced between full screen and regular modes
2406
+ const localStorageData = id ? JSON.parse(localStorage.getItem(id)) : null;
2407
+ const [page, setPage] = (0, $hgUW1$useState)(1);
2408
+ const [columnOrder, setColumnOrder] = (0, $hgUW1$useState)(()=>{
2409
+ if (datasetTableControls && localStorageData) return localStorageData.tableColumnOrder;
2410
+ else return [];
2411
+ });
2412
+ const [columnVisibility, setColumnVisibility] = (0, $hgUW1$useState)(()=>{
2413
+ if (datasetTableControls && localStorageData) return localStorageData.tableColumnVisibility;
2414
+ else return {};
2415
+ });
2416
+ const [tableDensity, setTableDensity] = (0, $hgUW1$useState)("normal");
2417
+ const providerValue = {
2418
+ columnOrder: columnOrder,
2419
+ setColumnOrder: setColumnOrder,
2420
+ columnVisibility: columnVisibility,
2421
+ setColumnVisibility: setColumnVisibility,
2422
+ page: page,
2423
+ setPage: setPage,
2424
+ tableDensity: tableDensity,
2425
+ setTableDensity: setTableDensity
2426
+ };
2427
+ return /*#__PURE__*/ (0, $hgUW1$jsx)($ee0d4d4f34048447$export$f814ea079e65d8fe.Provider, {
2428
+ value: providerValue,
2429
+ children: children
2430
+ });
2431
+ };
2432
+ const $ee0d4d4f34048447$export$67f91330d613e8f4 = ({ children: children, value: value = $ee0d4d4f34048447$var$DataTableActionsContextDefaults })=>/*#__PURE__*/ (0, $hgUW1$jsx)($ee0d4d4f34048447$export$f814ea079e65d8fe.Provider, {
2433
+ value: value,
2434
+ children: children
2435
+ });
2436
+ var $ee0d4d4f34048447$export$2e2bcd8739ae039 = $ee0d4d4f34048447$var$DataTableActionsProvider;
2437
+
2438
+
2439
+
2440
+
2284
2441
 
2285
2442
 
2286
2443
 
@@ -2350,10 +2507,6 @@ var $5fe94aeb50e0798b$export$2e2bcd8739ae039 = $5fe94aeb50e0798b$var$Card;
2350
2507
 
2351
2508
 
2352
2509
 
2353
- const $ebda441784d176a5$var$ManageColumnsContext = /*#__PURE__*/ (0, $hgUW1$createContext)({});
2354
- var $ebda441784d176a5$export$2e2bcd8739ae039 = $ebda441784d176a5$var$ManageColumnsContext;
2355
-
2356
-
2357
2510
 
2358
2511
  class $5d9e2ce238d53d29$var$ExcludeCheckboxKeyboardSensor extends (0, $hgUW1$KeyboardSensor) {
2359
2512
  // Custom function to exclude checkbox from keyboard dragging
@@ -2391,8 +2544,10 @@ class $5d9e2ce238d53d29$var$ExcludeCheckboxPointerSensor extends (0, $hgUW1$Poin
2391
2544
  }
2392
2545
  ];
2393
2546
  }
2394
- const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, modalOpen: modalOpen, setModalOpen: setModalOpen })=>{
2395
- const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $ebda441784d176a5$export$2e2bcd8739ae039));
2547
+ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder })=>{
2548
+ const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, setColumnVisibility: setColumnVisibility, columnVisibility: contextColumnVisibility } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
2549
+ const columnVisibility = contextColumnVisibility || {};
2550
+ const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
2396
2551
  // maintain card state separately from table state - only sync states when the Save button is pressed
2397
2552
  const [cards, setCards] = (0, $hgUW1$useState)(columns.map((c)=>{
2398
2553
  return {
@@ -2449,137 +2604,164 @@ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, default
2449
2604
  };
2450
2605
  }));
2451
2606
  };
2452
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2453
- className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
2454
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
2455
- heading: "Manage columns",
2456
- isOpen: modalOpen,
2457
- onExit: ()=>{
2458
- setModalOpen(false);
2459
- resetCards();
2460
- },
2461
- className: "dkan-manage-columns-dialog",
2462
- actions: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2463
- className: "ds-u-display--flex ds-u-justify-content--between ds-u-flex-wrap--wrap ds-u-padding-x--3 ds-u-padding-bottom--1 ds-u-sm-padding-bottom--3",
2607
+ const hiddenColumns = Object.keys(columnVisibility).filter((key)=>columnVisibility[key] === false).length;
2608
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2609
+ className: "dkan-manage-columns-wrapper",
2610
+ children: [
2611
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
2612
+ "aria-label": "Manage columns - Opens in a dialog",
2613
+ className: "dkan-filter-dataset-toolbar-button ds-u-color--primary ds-u-text-decoration--underline ds-u-font-size--sm ds-u-padding-x--2 ds-u-margin--0 ds-u-border--0 ds-u-fill--transparent",
2614
+ onClick: ()=>{
2615
+ setModalOpen(true);
2616
+ },
2464
2617
  children: [
2465
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2466
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0",
2618
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2619
+ className: "fa fa-columns ds-u-margin-right--1"
2620
+ }),
2621
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2467
2622
  children: [
2468
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2469
- variation: "solid",
2470
- className: "ds-l-col--6 ds-l-sm-col--auto",
2471
- onClick: ()=>{
2472
- setModalOpen(false);
2473
- // update table state
2474
- // Visibility
2475
- // This code is building a new columnVisibility state object from the card state and doing a single setState on the table
2476
- // vs doing a setState on every changed column individually
2477
- const newColumnVisibility = Object.fromEntries(cards.map((c)=>Object.values(c)));
2478
- setColumnVisibility(newColumnVisibility);
2479
- // Card order
2480
- const newCardOrder = cards.map((c)=>{
2481
- return c.id;
2482
- });
2483
- setColumnOrder(newCardOrder);
2484
- // save to localStorage
2485
- const localStorageData = {
2486
- tableColumnOrder: newCardOrder,
2487
- tableColumnVisibility: newColumnVisibility
2488
- };
2489
- localStorage.setItem(id, JSON.stringify(localStorageData));
2490
- },
2491
- children: "Save"
2623
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2624
+ className: "ds-u-display--none ds-u-lg-display--inline-block",
2625
+ children: "Manage Columns"
2492
2626
  }),
2493
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2494
- variation: "ghost",
2495
- className: "ds-l-col--6 ds-l-sm-col--auto",
2496
- onClick: ()=>{
2497
- setModalOpen(false);
2498
- resetCards();
2499
- },
2500
- children: "Cancel"
2501
- })
2627
+ hiddenColumns ? ` (${hiddenColumns})` : ""
2502
2628
  ]
2503
- }),
2504
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2505
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-padding-top--1 ds-u-sm-padding-y--0",
2506
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2507
- variation: "ghost",
2508
- className: "ds-l-col--6 ds-l-sm-col--auto",
2509
- onClick: ()=>{
2510
- // reset to default column order and set all cards to visible
2511
- // do not save this to the table state until the "Save" button is clicked
2512
- setCards(defaultColumnOrder.map((column)=>{
2513
- const card = cards.filter((c)=>c.id === column)[0];
2514
- return {
2515
- ...card,
2516
- visible: true
2517
- };
2518
- }));
2519
- },
2520
- children: "Reset Columns"
2521
- })
2522
2629
  })
2523
2630
  ]
2524
2631
  }),
2525
- children: [
2526
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2527
- id: "reorder-help",
2528
- className: "ds-u-padding-x--3",
2529
- children: "Activate the reorder button and use the arrow keys to reorder the list or use your mouse to drag/reorder. Press escape to cancel the reordering."
2530
- }),
2531
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
2532
- checked: cardHiddenColumns === 0,
2533
- type: "checkbox",
2534
- onChange: ()=>{
2535
- setCards(cards.map((c)=>{
2536
- return {
2537
- ...c,
2538
- visible: cardHiddenColumns !== 0
2539
- };
2540
- }));
2632
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2633
+ className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
2634
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
2635
+ heading: "Manage columns",
2636
+ isOpen: modalOpen,
2637
+ onExit: ()=>{
2638
+ setModalOpen(false);
2639
+ resetCards();
2541
2640
  },
2542
- className: "ds-u-padding-x--3",
2543
- name: "",
2544
- value: "",
2545
- label: "Select all",
2546
- hint: cardHiddenColumns && cardHiddenColumns + " columns hidden"
2547
- }),
2548
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2549
- className: "ds-u-display--flex ds-u-justify-content--between ds-u-font-weight--bold ds-u-padding-y--2 ds-u-padding-x--3 ds-u-border-y--1 ds-u-margin-top--2",
2641
+ className: "dkan-manage-columns-dialog",
2642
+ actions: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2643
+ className: "ds-u-display--flex ds-u-justify-content--between ds-u-flex-wrap--wrap ds-u-padding-x--3 ds-u-padding-bottom--1 ds-u-sm-padding-bottom--3",
2644
+ children: [
2645
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2646
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0",
2647
+ children: [
2648
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2649
+ variation: "solid",
2650
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2651
+ onClick: ()=>{
2652
+ setModalOpen(false);
2653
+ // update table state
2654
+ // Visibility
2655
+ // This code is building a new columnVisibility state object from the card state and doing a single setState on the table
2656
+ // vs doing a setState on every changed column individually
2657
+ const newColumnVisibility = Object.fromEntries(cards.map((c)=>Object.values(c)));
2658
+ setColumnVisibility(newColumnVisibility);
2659
+ // Card order
2660
+ const newCardOrder = cards.map((c)=>{
2661
+ return c.id;
2662
+ });
2663
+ setColumnOrder(newCardOrder);
2664
+ // save to localStorage
2665
+ const localStorageData = {
2666
+ tableColumnOrder: newCardOrder,
2667
+ tableColumnVisibility: newColumnVisibility
2668
+ };
2669
+ localStorage.setItem(id, JSON.stringify(localStorageData));
2670
+ },
2671
+ children: "Save"
2672
+ }),
2673
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2674
+ variation: "ghost",
2675
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2676
+ onClick: ()=>{
2677
+ setModalOpen(false);
2678
+ resetCards();
2679
+ },
2680
+ children: "Cancel"
2681
+ })
2682
+ ]
2683
+ }),
2684
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2685
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-padding-top--1 ds-u-sm-padding-y--0",
2686
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2687
+ variation: "ghost",
2688
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2689
+ onClick: ()=>{
2690
+ // reset to default column order and set all cards to visible
2691
+ // do not save this to the table state until the "Save" button is clicked
2692
+ setCards(defaultColumnOrder.map((column)=>{
2693
+ const card = cards.filter((c)=>c.id === column)[0];
2694
+ return {
2695
+ ...card,
2696
+ visible: true
2697
+ };
2698
+ }));
2699
+ },
2700
+ children: "Reset Columns"
2701
+ })
2702
+ })
2703
+ ]
2704
+ }),
2550
2705
  children: [
2551
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2552
- children: "Display column"
2706
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2707
+ id: "reorder-help",
2708
+ className: "ds-u-padding-x--3",
2709
+ children: "Activate the reorder button and use the arrow keys to reorder the list or use your mouse to drag/reorder. Press escape to cancel the reordering."
2553
2710
  }),
2554
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2555
- children: "Reorder"
2556
- })
2557
- ]
2558
- }),
2559
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$DndContext), {
2560
- collisionDetection: (0, $hgUW1$closestCenter),
2561
- modifiers: [
2562
- (0, $hgUW1$restrictToVerticalAxis)
2563
- ],
2564
- sensors: sensors,
2565
- onDragEnd: handleDragEnd,
2566
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$SortableContext), {
2567
- items: cardOrder,
2568
- strategy: (0, $hgUW1$verticalListSortingStrategy),
2569
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2570
- className: "dkan-manage-columns-list",
2571
- children: cards.map((card)=>{
2572
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5fe94aeb50e0798b$export$2e2bcd8739ae039), {
2573
- id: card.id,
2574
- visible: card.visible,
2575
- updateVisibility: updateVisibility
2576
- }, card.id);
2711
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
2712
+ checked: cardHiddenColumns === 0,
2713
+ type: "checkbox",
2714
+ onChange: ()=>{
2715
+ setCards(cards.map((c)=>{
2716
+ return {
2717
+ ...c,
2718
+ visible: cardHiddenColumns !== 0
2719
+ };
2720
+ }));
2721
+ },
2722
+ className: "ds-u-padding-x--3",
2723
+ name: "",
2724
+ value: "",
2725
+ label: "Select all",
2726
+ hint: cardHiddenColumns && cardHiddenColumns + " columns hidden"
2727
+ }),
2728
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2729
+ className: "ds-u-display--flex ds-u-justify-content--between ds-u-font-weight--bold ds-u-padding-y--2 ds-u-padding-x--3 ds-u-border-y--1 ds-u-margin-top--2",
2730
+ children: [
2731
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2732
+ children: "Display column"
2733
+ }),
2734
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2735
+ children: "Reorder"
2736
+ })
2737
+ ]
2738
+ }),
2739
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$DndContext), {
2740
+ collisionDetection: (0, $hgUW1$closestCenter),
2741
+ modifiers: [
2742
+ (0, $hgUW1$restrictToVerticalAxis)
2743
+ ],
2744
+ sensors: sensors,
2745
+ onDragEnd: handleDragEnd,
2746
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$SortableContext), {
2747
+ items: cardOrder,
2748
+ strategy: (0, $hgUW1$verticalListSortingStrategy),
2749
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2750
+ className: "dkan-manage-columns-list",
2751
+ children: cards.map((card)=>{
2752
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5fe94aeb50e0798b$export$2e2bcd8739ae039), {
2753
+ id: card.id,
2754
+ visible: card.visible,
2755
+ updateVisibility: updateVisibility
2756
+ }, card.id);
2757
+ })
2758
+ })
2577
2759
  })
2578
2760
  })
2579
- })
2761
+ ]
2580
2762
  })
2581
- ]
2582
- })
2763
+ })
2764
+ ]
2583
2765
  });
2584
2766
  };
2585
2767
  var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColumns;
@@ -2598,139 +2780,111 @@ var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColum
2598
2780
 
2599
2781
 
2600
2782
 
2783
+ function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
2784
+ return columns.map((column)=>({
2785
+ header: schema && schema.fields[column].description ? schema.fields[column].description : column,
2786
+ accessor: column
2787
+ }));
2788
+ }
2789
+ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, closeFullScreenModal: closeFullScreenModal, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
2790
+ const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
2791
+ const { page: page, setPage: setPage, tableDensity: tableDensity } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
2792
+ const defaultPageSize = 10;
2793
+ const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
2794
+ const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
2795
+ const { limit: limit, setOffset: setOffset } = resource;
2796
+ const pageSize = limit ? limit : defaultPageSize;
2797
+ const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
2798
+ conditions: resource.conditions
2799
+ }, {
2800
+ encode: true
2801
+ })}&format=csv`;
2802
+ if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
2803
+ children: [
2804
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2805
+ className: isModal ? "dkan-datatable-fullscreen-mode" : "",
2806
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
2807
+ canResize: true,
2808
+ columns: columns,
2809
+ sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
2810
+ tablePadding: tableDensity === "normal" ? "ds-u-padding-y--2" : tableDensity === "compact" ? "ds-u-padding-y--1" : "ds-u-padding-y--3",
2811
+ loading: resource.loading,
2812
+ isModal: isModal,
2813
+ closeFullScreenModal: closeFullScreenModal,
2814
+ downloadURL: downloadURL,
2815
+ unfilteredDownloadURL: distribution.data.downloadURL,
2816
+ setPage: setPage,
2817
+ showCopyLinkButton: showCopyLinkButton,
2818
+ showDownloadFilteredDataButton: showDownloadFilteredDataButton,
2819
+ showDownloadFullDataButton: showDownloadFullDataButton,
2820
+ showStoredQueryDownloadButton: showStoredQueryDownloadButton
2821
+ })
2822
+ }),
2823
+ !resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2824
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-md-justify-content--between ds-u-margin-top--2 ds-u-align-items--center",
2825
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
2826
+ totalPages: Math.ceil(resource.count ? resource.count / pageSize : 1),
2827
+ currentPage: Number(page),
2828
+ onPageChange: (evt, page)=>{
2829
+ evt.preventDefault();
2830
+ setOffset((page - 1) * limit);
2831
+ setPage(page);
2832
+ },
2833
+ renderHref: (p)=>`?page=${p}`,
2834
+ className: "ds-l-col--12 ds-u-padding-x--0"
2835
+ })
2836
+ })
2837
+ ]
2838
+ });
2839
+ else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
2840
+ "aria-valuetext": "Dataset loading",
2841
+ role: "status",
2842
+ className: "ds-u-margin--3"
2843
+ });
2844
+ };
2845
+ var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
2601
2846
 
2602
2847
 
2603
- const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL: downloadURL, unfilteredDownloadURL: unfilteredDownloadURL, setPage: setPage, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
2604
- const { limit: limit, offset: offset, count: count, conditions: conditions, setLimit: setLimit, setOffset: setOffset } = resource;
2605
- const intCount = count ? count : 0;
2606
- const rowOptions = [
2607
- 10,
2608
- 25,
2609
- 50,
2610
- 100
2611
- ];
2848
+ const $16bd41951b91f02d$var$FullScreenDataTable = ({ isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
2849
+ const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
2850
+ if (isModal) return null;
2612
2851
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2613
- className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between",
2852
+ className: "dkan-fullscreen-data-table-wrapper",
2614
2853
  children: [
2615
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2616
- className: "dc-c-resource-header--buttons ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-l-col--12 ds-u-margin-top--2 ds-u-padding-x--0",
2854
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
2855
+ "aria-label": isModal ? "Close Full Screen dialog" : "Full Screen mode - Opens in a dialog",
2856
+ className: "dkan-filter-dataset-toolbar-button ds-u-color--primary ds-u-text-decoration--underline ds-u-font-size--sm ds-u-padding-x--2 ds-u-margin--0 ds-u-border--0 ds-u-fill--transparent",
2857
+ onClick: ()=>{
2858
+ if (isModal) closeFullScreenModal();
2859
+ else setModalOpen(true);
2860
+ },
2617
2861
  children: [
2618
- showCopyLinkButton && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2619
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-bottom--2",
2620
- children: conditions && conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
2621
- onOpen: ()=>{
2622
- navigator.clipboard.writeText(window.location.href);
2623
- },
2624
- className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2625
- placement: "bottom",
2626
- dialog: true,
2627
- ariaLabel: "Copy link to filtered data",
2628
- title: "Link copied to clipboard",
2629
- "aria-disabled": !conditions || conditions.length === 0,
2630
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2631
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2632
- children: [
2633
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2634
- className: "fas fa-copy"
2635
- }),
2636
- " Copy link to filtered data"
2637
- ]
2638
- })
2639
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2640
- "aria-disabled": true,
2641
- "aria-label": "Copy link to filtered data",
2642
- className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2643
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2644
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2645
- children: [
2646
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2647
- className: "fas fa-copy"
2648
- }),
2649
- " Copy link to filtered data"
2650
- ]
2651
- })
2652
- })
2862
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2863
+ className: `fa ${isModal ? "fa-compress" : "fa-expand"} ds-u-margin-right--1`
2653
2864
  }),
2654
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2655
- className: "ds-l-col--12 ds-l-md-col--auto ds-u-padding-x--0 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
2656
- children: [
2657
- (showDownloadFilteredDataButton || showStoredQueryDownloadButton) && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2658
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
2659
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2660
- className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
2661
- href: downloadURL,
2662
- "aria-disabled": !conditions || conditions.length === 0,
2663
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2664
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2665
- children: [
2666
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2667
- className: "fas fa-file-csv"
2668
- }),
2669
- " ",
2670
- showDownloadFilteredDataButton ? `Download filtered data (CSV)` : `Download stored query data (CSV)`
2671
- ]
2672
- })
2673
- })
2674
- }),
2675
- showDownloadFullDataButton && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2676
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
2677
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2678
- className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
2679
- href: unfilteredDownloadURL,
2680
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2681
- className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2682
- children: [
2683
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2684
- className: "fas fa-file-csv"
2685
- }),
2686
- " Download full dataset (CSV)"
2687
- ]
2688
- })
2689
- })
2690
- })
2691
- ]
2865
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2866
+ className: "ds-u-display--none ds-u-lg-display--inline-block",
2867
+ children: isModal ? "Exit Full Screen" : "Full Screen"
2692
2868
  })
2693
2869
  ]
2694
2870
  }),
2695
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2696
- className: "ds-l-col--12 ds-u-display--flex ds-u-align-items--end ds-u-flex-direction--row-reverse ds-u-sm-flex-direction--row ds-u-padding-x--0 ds-u-margin-bottom--2 ds-u-flex-wrap--wrap",
2697
- children: [
2698
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2699
- className: "ds-l-col--12 ds-l-sm-col--8 ds-u-padding-x--0",
2700
- children: !resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
2701
- totalRows: intCount,
2702
- limit: limit,
2703
- offset: offset
2704
- })
2705
- }),
2706
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2707
- className: "ds-l-col--12 ds-l-sm-col--4 ds-u-display--flex ds-u-justify-content--end ds-u-padding-x--0",
2708
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2709
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2710
- options: rowOptions.map((row)=>({
2711
- label: row.toString(),
2712
- value: row
2713
- })),
2714
- size: "medium",
2715
- label: "Rows per page:",
2716
- labelClassName: "ds-u-margin-top--0",
2717
- name: "datatable_rows_per_page",
2718
- onChange: (e)=>{
2719
- setLimit(parseInt(e.target.value));
2720
- setPage(1);
2721
- setOffset(0);
2722
- },
2723
- value: limit.toString(),
2724
- defaultValue: limit.toString()
2725
- })
2726
- })
2871
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2872
+ className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
2873
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dialog), {
2874
+ heading: "Dataset Explorer",
2875
+ isOpen: modalOpen,
2876
+ onExit: ()=>setModalOpen(false),
2877
+ className: "dkan-full-screen-dataset-dialog",
2878
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
2879
+ isModal: true,
2880
+ closeFullScreenModal: ()=>setModalOpen(false)
2727
2881
  })
2728
- ]
2882
+ })
2729
2883
  })
2730
2884
  ]
2731
2885
  });
2732
2886
  };
2733
- var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHeader;
2887
+ var $16bd41951b91f02d$export$2e2bcd8739ae039 = $16bd41951b91f02d$var$FullScreenDataTable;
2734
2888
 
2735
2889
 
2736
2890
 
@@ -2742,74 +2896,6 @@ var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHe
2742
2896
 
2743
2897
 
2744
2898
 
2745
- const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
2746
- const { fields: fields } = schema;
2747
- const prependedMessage = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2748
- children: "Data filters: "
2749
- });
2750
- if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2751
- className: "ds-u-margin-y--0",
2752
- children: [
2753
- prependedMessage,
2754
- " none"
2755
- ]
2756
- });
2757
- function formatValue(text, property) {
2758
- if (customColumns && customColumns.length > 0) {
2759
- let newValue = text;
2760
- let customColumn = customColumns.find((c)=>c.accessor === property);
2761
- if (customColumn && customColumn.cell) return customColumn.cell({
2762
- value: text
2763
- });
2764
- return text;
2765
- } else return text;
2766
- }
2767
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2768
- className: "dc-querybuilder-title",
2769
- children: [
2770
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2771
- className: "ds-u-margin-y--0",
2772
- children: prependedMessage
2773
- }),
2774
- conditions.map((c)=>{
2775
- const field = fields[c.property];
2776
- const description = field && field.description ? field.description : c.property;
2777
- const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
2778
- const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
2779
- const formattedText = formatValue(cleanedText, c.property);
2780
- return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2781
- className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
2782
- children: [
2783
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2784
- className: "ds-u-font-weight--bold",
2785
- children: description
2786
- }),
2787
- " ",
2788
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2789
- className: "ds-u-font-weight--normal",
2790
- children: operator.label.toUpperCase()
2791
- }),
2792
- " ",
2793
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2794
- className: "ds-u-color--success",
2795
- children: formattedText
2796
- })
2797
- ]
2798
- });
2799
- }).reduce((prev, curr)=>[
2800
- prev,
2801
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
2802
- className: "ds-u-margin-x--1",
2803
- variation: "info",
2804
- children: "AND"
2805
- }),
2806
- curr
2807
- ])
2808
- ]
2809
- });
2810
- };
2811
- var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
2812
-
2813
2899
 
2814
2900
 
2815
2901
 
@@ -2817,19 +2903,18 @@ var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
2817
2903
 
2818
2904
 
2819
2905
 
2820
-
2821
- function $6369abf590ca298f$var$getStartDate(condition, schema, id) {
2906
+ function $eadd6431fddf4b6c$var$getStartDate(condition, schema, id) {
2822
2907
  if (schema[id].fields[condition.property].mysql_type === "date") {
2823
2908
  const newDate = new Date(condition.value.toString());
2824
2909
  if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
2825
2910
  }
2826
2911
  return new Date();
2827
2912
  }
2828
- const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema })=>{
2913
+ const $eadd6431fddf4b6c$var$FilterItem = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema, className: className = "" })=>{
2829
2914
  const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
2830
2915
  const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
2831
2916
  const [value, setValue] = (0, $hgUW1$useState)(condition.value);
2832
- const [startDate, setStartDate] = (0, $hgUW1$react).useState($6369abf590ca298f$var$getStartDate(condition, schema, id));
2917
+ const [startDate, setStartDate] = (0, $hgUW1$react).useState($eadd6431fddf4b6c$var$getStartDate(condition, schema, id));
2833
2918
  const xl = (0, $hgUW1$useMediaQuery)({
2834
2919
  minWidth: 1280
2835
2920
  });
@@ -2866,102 +2951,95 @@ const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: i
2866
2951
  value
2867
2952
  ]);
2868
2953
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
2869
- className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between ds-u-align-items--center ds-u-border--0",
2954
+ className: `dkan-filter-dataset-control ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--1 ds-u-margin-top--05${className !== "" ? ` ${className}` : ""}`,
2870
2955
  children: [
2871
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2872
- className: "ds-l-col--12 ds-l-md-col--8 ds-u-display--flex ds-u-justify-content--between ds-u-padding-x--0",
2873
- children: [
2874
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2875
- options: propertyOptions,
2876
- className: "ds-l-col--8 ds-u-padding-left--0",
2877
- value: property,
2878
- label: "Column Name",
2879
- name: `${condition.key}_property`,
2880
- onChange: (e)=>setProperty(e.target.value)
2881
- }),
2882
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2883
- options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
2884
- className: "ds-l-col--4 ds-u-padding-x--0",
2885
- value: operator,
2886
- label: "Operator",
2887
- name: `${condition.key}_operator`,
2888
- onChange: (e)=>setOperator(e.target.value)
2889
- })
2890
- ]
2956
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2957
+ options: propertyOptions,
2958
+ className: "ds-u-padding-x--0",
2959
+ value: property,
2960
+ label: "Column Name",
2961
+ name: `${condition.key}_property`,
2962
+ onChange: (e)=>setProperty(e.target.value)
2891
2963
  }),
2892
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2893
- className: "ds-l-col--12 ds-l-md-col--4 ds-u-padding-x--0 ds-u-md-padding-left--2 ds-u-display--flex ds-u-justify-content--between",
2964
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2965
+ options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
2966
+ className: "ds-u-padding-x--0",
2967
+ value: operator,
2968
+ label: "Condition",
2969
+ name: `${condition.key}_operator`,
2970
+ onChange: (e)=>setOperator(e.target.value)
2971
+ }),
2972
+ schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2894
2973
  children: [
2895
- schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2896
- children: [
2897
- /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
2898
- className: "ds-c-label",
2899
- htmlFor: `${condition.key}_date_value`,
2900
- id: `${condition.key}_date_value-label`,
2901
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2902
- children: "Value"
2903
- })
2904
- }),
2905
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
2906
- name: `${condition.key}_date_value`,
2907
- selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
2908
- onChange: (date)=>{
2909
- setStartDate(date);
2910
- setValue(date.toJSON().slice(0, 10));
2911
- },
2912
- showMonthDropdown: true,
2913
- showYearDropdown: true,
2914
- dropdownMode: "select",
2915
- className: "ds-c-field",
2916
- withPortal: true
2917
- })
2918
- ]
2919
- }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
2920
- className: "ds-l-col--11 ds-u-padding-x--0",
2921
- label: "Value",
2922
- name: `${condition.key}_value`,
2923
- value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
2924
- onChange: (e)=>setValue(e.target.value)
2925
- }),
2926
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2927
- variation: "ghost",
2928
- size: "small",
2929
- className: "ds-u-margin-top--6 ds-u-padding-right--0",
2930
- "aria-label": "Delete filter",
2931
- onClick: ()=>remove(index),
2974
+ /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
2975
+ className: "ds-c-label",
2976
+ htmlFor: `${condition.key}_date_value`,
2977
+ id: `${condition.key}_date_value-label`,
2932
2978
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2933
- className: "fas fa-trash"
2979
+ children: "Value"
2934
2980
  })
2981
+ }),
2982
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
2983
+ name: `${condition.key}_date_value`,
2984
+ selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
2985
+ onChange: (date)=>{
2986
+ setStartDate(date);
2987
+ setValue(date.toJSON().slice(0, 10));
2988
+ },
2989
+ showMonthDropdown: true,
2990
+ showYearDropdown: true,
2991
+ dropdownMode: "select",
2992
+ className: "ds-c-field",
2993
+ withPortal: true
2935
2994
  })
2936
2995
  ]
2996
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
2997
+ className: "ds-u-padding-x--0",
2998
+ label: "Value",
2999
+ name: `${condition.key}_value`,
3000
+ value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
3001
+ onChange: (e)=>setValue(e.target.value),
3002
+ placeholder: "Enter value"
3003
+ }),
3004
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3005
+ variation: "ghost",
3006
+ size: "small",
3007
+ className: "dkan-delete-dataset-filter-button ds-u-padding-x--0 ds-u-margin-left--05 ds-u-md-margin-top--0 ds-u-border--1 ds-u-border--dark ds-u-color--black",
3008
+ "aria-label": "Delete filter",
3009
+ onClick: ()=>remove(index),
3010
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3011
+ className: "far fa-trash"
3012
+ })
2937
3013
  })
2938
3014
  ]
2939
3015
  });
2940
3016
  };
2941
- var $6369abf590ca298f$export$2e2bcd8739ae039 = $6369abf590ca298f$var$QueryRow;
3017
+ var $eadd6431fddf4b6c$export$2e2bcd8739ae039 = $eadd6431fddf4b6c$var$FilterItem;
2942
3018
 
2943
3019
 
2944
3020
 
2945
3021
 
2946
3022
 
2947
3023
 
2948
- const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn })=>{
3024
+
3025
+ const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn, disableDefaultClasses: disableDefaultClasses = false, className: className = "" })=>{
2949
3026
  const small = (0, $hgUW1$useMediaQuery)({
2950
3027
  minWidth: 0,
2951
3028
  maxWidth: 544
2952
3029
  });
2953
3030
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2954
3031
  disabled: disabled,
2955
- className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5",
3032
+ className: `dkan-clear-dataset-filters-button ${disableDefaultClasses ? "" : " ds-u-float--right ds-l-md-col--6 ds-l-col--5"}${className !== "" ? ` ${className}` : ""}`,
2956
3033
  variation: small ? "ghost" : undefined,
2957
3034
  onClick: ()=>clearFiltersFn(),
2958
- children: small ? "Clear all" : "Clear all filters"
3035
+ children: "Reset"
2959
3036
  });
2960
3037
  };
2961
3038
  var $2eec38d4d0dbf714$export$2e2bcd8739ae039 = $2eec38d4d0dbf714$var$ClearFiltersButton;
2962
3039
 
2963
3040
 
2964
- function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
3041
+
3042
+ function $6f4318b1e14124e5$var$updateQueryForDatastore(condition) {
2965
3043
  let cond = condition;
2966
3044
  delete cond.key;
2967
3045
  if (cond.operator === "=" || cond.operator === "<>") {
@@ -2979,12 +3057,19 @@ function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
2979
3057
  if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
2980
3058
  return cond;
2981
3059
  }
2982
- const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, customColumns: customColumns, isModal: isModal = false, setPage: setPage, setOffset: setOffset })=>{
2983
- const { conditions: conditions, schema: schema, setConditions: setConditions } = resource;
3060
+ const $6f4318b1e14124e5$var$FilterDataset = ()=>{
3061
+ const { distribution: distribution, resource: resource, customColumns: customColumns = [] } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
3062
+ const { setPage: setPage } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
3063
+ if (!resource) return null;
3064
+ const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
3065
+ const id = distribution.identifier;
3066
+ const columns = customColumnHeaders ? customColumnHeaders : (0, $a35cf16d1488f54e$export$1147582dfae658c6)(resource.columns, resource.schema[id]);
3067
+ const { conditions: conditions, schema: schema, setConditions: setConditions, setOffset: setOffset } = resource;
2984
3068
  const fields = Object.keys(schema[id].fields);
2985
3069
  const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
2986
- const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]); // Add use effect to load conditions on first load if needed
3070
+ const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]);
2987
3071
  const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);
3072
+ const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
2988
3073
  const syncConditions = ()=>{
2989
3074
  if (conditions && conditions.length) {
2990
3075
  const keyedConditions = conditions.map((oc)=>({
@@ -3019,7 +3104,7 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, custom
3019
3104
  ]);
3020
3105
  };
3021
3106
  // Sync the UI with the actual data conditions whenever those change
3022
- (0, $hgUW1$react).useEffect(()=>{
3107
+ (0, $hgUW1$useEffect)(()=>{
3023
3108
  syncConditions();
3024
3109
  setTitleConditions(conditions);
3025
3110
  }, [
@@ -3045,21 +3130,37 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, custom
3045
3130
  });
3046
3131
  window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
3047
3132
  };
3048
- const submitConditions = (e)=>{
3133
+ const submitConditions = ()=>{
3049
3134
  // only update the data conditions when "Apply filters" is pressed
3050
- e.preventDefault();
3051
3135
  const submitConditions = queryConditions.filter((oc)=>{
3052
3136
  if (oc.property) return oc;
3053
3137
  return false;
3054
3138
  }).map((oc)=>{
3055
3139
  let cond = Object.assign({}, oc);
3056
- return $ee4ad47aa483e5b5$var$updateQueryForDatastore(cond);
3140
+ return $6f4318b1e14124e5$var$updateQueryForDatastore(cond);
3057
3141
  });
3058
- setConditions(submitConditions);
3059
- setPage(1);
3060
- setOffset(0);
3061
- setConditionsChanged(false);
3062
- updateBrowserURL(submitConditions);
3142
+ const completeConditions = conditionsReadyToSubmit(submitConditions);
3143
+ if (completeConditions.length) {
3144
+ setConditions(completeConditions);
3145
+ setPage(1);
3146
+ setOffset(0);
3147
+ setConditionsChanged(false);
3148
+ updateBrowserURL(completeConditions);
3149
+ setModalOpen(false);
3150
+ }
3151
+ };
3152
+ const conditionsReadyToSubmit = (conditions)=>{
3153
+ const isEmpty = (val)=>{
3154
+ if (typeof val === "string") return val.trim() === "";
3155
+ if (Array.isArray(val)) return val.length === 0;
3156
+ return true;
3157
+ };
3158
+ const completeConditions = conditions.filter((condition)=>{
3159
+ if (condition) {
3160
+ if (!isEmpty(condition.property) && !isEmpty(condition.operator) && !isEmpty(condition.value)) return condition;
3161
+ }
3162
+ });
3163
+ return completeConditions;
3063
3164
  };
3064
3165
  const updateCondition = (index, key, value)=>{
3065
3166
  let newConditions = [
@@ -3075,258 +3176,451 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, custom
3075
3176
  newConditions.splice(index, 1);
3076
3177
  setQueryConditions(newConditions);
3077
3178
  setConditionsChanged(true);
3179
+ if (newConditions.length === 0) {
3180
+ setConditions([]);
3181
+ updateBrowserURL([]);
3182
+ }
3078
3183
  };
3079
- return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3080
- className: "dc-query-builder ds-u-margin-bottom--3",
3081
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3082
- className: "ds-c-accordion ds-c-accordion--bordered",
3083
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
3084
- heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
3085
- schema: schema[id],
3086
- conditions: titleConditions,
3087
- customColumns: customColumns
3088
- }),
3089
- defaultOpen: !isModal,
3090
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
3091
- onSubmit: (e)=>submitConditions(e),
3184
+ const disableFilterSubmitButton = ()=>{
3185
+ return !conditionsChanged || queryConditions.length === 0 || conditionsReadyToSubmit(queryConditions).length === 0;
3186
+ };
3187
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
3188
+ children: Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3189
+ className: "dkan-filter-dataset-wrapper",
3190
+ children: [
3191
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
3192
+ "aria-label": "Filter dataset - Opens in a dialog",
3193
+ className: "dkan-filter-dataset-toolbar-button ds-u-color--primary ds-u-text-decoration--underline ds-u-font-size--sm ds-u-padding-x--2 ds-u-margin--0 ds-u-border--0 ds-u-fill--transparent",
3194
+ onClick: ()=>{
3195
+ setModalOpen(true);
3196
+ },
3092
3197
  children: [
3093
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3094
- children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $6369abf590ca298f$export$2e2bcd8739ae039), {
3095
- id: id,
3096
- schema: schema,
3097
- condition: qf,
3098
- index: index,
3099
- propertyOptions: propertyOptions,
3100
- update: updateCondition,
3101
- remove: removeCondition
3102
- }, qf.key))
3198
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3199
+ className: "fa fa-filter ds-u-margin-right--1"
3103
3200
  }),
3104
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3105
- className: "dc-query-bulder--form-buttons ds-u-padding-x--2 ds-u-padding-top--0 ds-u-md-padding-top--2 ds-u-display--flex ds-u-flex-wrap--wrap",
3201
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3106
3202
  children: [
3107
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3108
- className: "ds-l-col--12 ds-l-md-col--4 ds-l-md-col--6 ds-u-padding-x--0 ds-u-margin-bottom--2 ds-u-md-margin-bottom--0",
3109
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3110
- variation: "ghost",
3111
- onClick: ()=>addCondition(null),
3112
- className: "ds-u-padding-left--0",
3113
- children: "+ Add filter"
3203
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3204
+ className: "ds-u-display--none ds-u-lg-display--inline-block",
3205
+ children: conditions.length > 0 ? `Edit Filters` : "Filter Dataset"
3206
+ }),
3207
+ conditions.length > 0 && ` (${conditions.length})`
3208
+ ]
3209
+ })
3210
+ ]
3211
+ }),
3212
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3213
+ className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
3214
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dialog), {
3215
+ heading: "Filter Dataset",
3216
+ isOpen: modalOpen,
3217
+ onExit: ()=>setModalOpen(false),
3218
+ className: "dkan-filter-dataset-dialog",
3219
+ ariaCloseLabel: "Close filter dataset dialog",
3220
+ actions: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3221
+ className: "ds-u-display--flex ds-u-justify-content--end ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--2",
3222
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3223
+ className: "ds-u-display--flex ",
3224
+ children: [
3225
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3226
+ disabled: queryConditions.length === 0,
3227
+ clearFiltersFn: ()=>{
3228
+ setConditions([]);
3229
+ updateBrowserURL([]);
3230
+ },
3231
+ disableDefaultClasses: true,
3232
+ className: "ds-l-md-col--auto ds-l-col--auto ds-u-margin--right--0 ds-u-sm-margin-right--2"
3233
+ }),
3234
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3235
+ disabled: disableFilterSubmitButton(),
3236
+ className: "dkan-apply-dataset-filters-button ds-u-float--right ds-l-md-col--auto ds-l-col--auto",
3237
+ onClick: submitConditions,
3238
+ variation: "solid",
3239
+ children: `Apply ${conditionsReadyToSubmit(queryConditions).length || ""} filter${conditionsReadyToSubmit(queryConditions).length === 1 ? "" : "s"}`
3114
3240
  })
3241
+ ]
3242
+ })
3243
+ }),
3244
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3245
+ children: [
3246
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3247
+ className: "ds-u-margin--0 ds-u-margin-top--1 ds-u-margin-bottom--2 ds-u-padding-x--2 ds-u-md-padding-x--3",
3248
+ children: "Add filters to only display data that meets your criteria. Filtered results can be downloaded."
3115
3249
  }),
3116
3250
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3117
- className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
3251
+ className: "dkan-filter-dataset-controls-header ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--1 ds-u-margin-top--05 ds-u-fill--gray-lightest",
3118
3252
  children: [
3119
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3120
- disabled: !conditionsChanged,
3121
- className: "ds-u-float--right ds-l-md-col--6 ds-u-margin--right--0 ds-u-sm-margin-right--2",
3122
- type: "submit",
3123
- variation: "solid",
3124
- children: "Apply filters"
3253
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
3254
+ className: "ds-u-margin--0 ds-u-font-weight--bold ds-u-padding--0",
3255
+ children: "Column Name"
3125
3256
  }),
3126
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3127
- disabled: queryConditions.length === 0,
3128
- clearFiltersFn: ()=>{
3129
- setConditions([]);
3130
- updateBrowserURL([]);
3131
- }
3257
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
3258
+ className: "ds-u-margin--0 ds-u-font-weight--bold ds-u-padding--0",
3259
+ children: "Condition"
3260
+ }),
3261
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
3262
+ className: "ds-u-margin--0 ds-u-font-weight--bold ds-u-padding--0",
3263
+ children: "Value"
3264
+ }),
3265
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3266
+ className: "dkan-filter-dataset-controls-header-gutter"
3132
3267
  })
3133
3268
  ]
3269
+ }),
3270
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3271
+ className: "dkan-filter-dataset-form-container ds-u-display--flex ds-u-flex-direction--column ds-u-border-bottom--1",
3272
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3273
+ className: "ds-u-padding-bottom--05",
3274
+ children: [
3275
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3276
+ className: "dkan-filter-dataset-controls",
3277
+ children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $eadd6431fddf4b6c$export$2e2bcd8739ae039), {
3278
+ id: id,
3279
+ schema: schema,
3280
+ condition: qf,
3281
+ index: index,
3282
+ propertyOptions: propertyOptions,
3283
+ update: updateCondition,
3284
+ remove: removeCondition,
3285
+ className: index !== 0 ? "ds-u-border-top--1" : "ds-u-border--0"
3286
+ }, qf.key))
3287
+ }),
3288
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3289
+ className: "ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--1 ds-u-border-top--1 ds-u-margin-top--05",
3290
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3291
+ onClick: ()=>addCondition(null),
3292
+ className: "dkan-add-dataset-filter-button ds-l-col--12 ds-u-radius--pill ds-u-margin-top--05 ds-u-font-weight--normal",
3293
+ children: "+ Add filter"
3294
+ })
3295
+ })
3296
+ ]
3297
+ })
3134
3298
  })
3135
3299
  ]
3136
3300
  })
3137
- ]
3301
+ })
3138
3302
  })
3139
- })
3140
- })
3303
+ ]
3304
+ }) : null
3141
3305
  });
3142
3306
  };
3143
- var $ee4ad47aa483e5b5$export$2e2bcd8739ae039 = $ee4ad47aa483e5b5$var$QueryBuilder;
3307
+ var $6f4318b1e14124e5$export$2e2bcd8739ae039 = $6f4318b1e14124e5$var$FilterDataset;
3144
3308
 
3145
3309
 
3146
3310
 
3147
- const $43a30d745a7bbc86$var$DataTableContext = /*#__PURE__*/ (0, $hgUW1$createContext)({
3148
- id: null
3149
- });
3150
- var $43a30d745a7bbc86$export$2e2bcd8739ae039 = $43a30d745a7bbc86$var$DataTableContext;
3151
-
3152
3311
 
3153
3312
 
3154
- function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
3155
- return columns.map((column)=>({
3156
- header: schema && schema.fields[column].description ? schema.fields[column].description : column,
3157
- accessor: column
3158
- }));
3159
- }
3160
- const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, closeFullScreenModal: closeFullScreenModal, showQueryBuilder: showQueryBuilder = true, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
3161
- const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
3162
- const { page: page, setPage: setPage } = (0, $hgUW1$useContext)((0, $ebda441784d176a5$export$2e2bcd8739ae039));
3163
- const defaultPageSize = 10;
3164
- const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
3165
- const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
3166
- const { limit: limit, setOffset: setOffset } = resource;
3167
- const pageSize = limit ? limit : defaultPageSize;
3168
- const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
3169
- conditions: resource.conditions
3170
- }, {
3171
- encode: true
3172
- })}&format=csv`;
3173
- if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3313
+ const $c5b172e8d1a8197c$var$FliterChip = ({ iconClass: iconClass, text: text, onClick: onClick })=>{
3314
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
3315
+ className: "dkan-filter-chip ds-u-display--flex ds-u-font-size--sm ds-u-align-items--center ds-u-padding-x--1 ds-u-padding-y--05 ds-u-margin--0 ds-u-margin-right--1 ds-u-margin-bottom--1",
3316
+ onClick: onClick,
3174
3317
  children: [
3175
- showQueryBuilder && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee4ad47aa483e5b5$export$2e2bcd8739ae039), {
3176
- resource: resource,
3177
- id: distribution.identifier,
3178
- customColumns: customColumnHeaders,
3179
- isModal: isModal,
3180
- setPage: setPage,
3181
- setOffset: setOffset
3182
- }),
3183
- dataDictionaryBanner && !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3184
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3185
- children: 'Click on the "Data Dictionary" tab above for full column definitions'
3186
- })
3318
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3319
+ className: `${iconClass} ds-u-color--primary ds-u-margin-right--1`
3187
3320
  }),
3188
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6380a4a580b24362$export$2e2bcd8739ae039), {
3189
- resource: resource,
3190
- downloadURL: downloadURL,
3191
- unfilteredDownloadURL: distribution.data.downloadURL,
3192
- setPage: setPage,
3193
- showCopyLinkButton: showCopyLinkButton,
3194
- showDownloadFilteredDataButton: showDownloadFilteredDataButton,
3195
- showDownloadFullDataButton: showDownloadFullDataButton,
3196
- showStoredQueryDownloadButton: showStoredQueryDownloadButton
3197
- }),
3198
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3199
- className: `ds-u-border-x--1 ds-u-border-bottom--1 ${isModal && "dkan-datatable-fullscreen-mode"}`,
3200
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
3201
- canResize: true,
3202
- columns: columns,
3203
- sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
3204
- tablePadding: "ds-u-padding-y--2",
3205
- loading: resource.loading,
3206
- isModal: isModal,
3207
- closeFullScreenModal: closeFullScreenModal
3208
- })
3209
- }),
3210
- !resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3211
- className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-md-justify-content--between ds-u-margin-top--2 ds-u-align-items--center",
3212
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3213
- totalPages: Math.ceil(resource.count ? resource.count / pageSize : 1),
3214
- currentPage: Number(page),
3215
- onPageChange: (evt, page)=>{
3216
- evt.preventDefault();
3217
- setOffset((page - 1) * limit);
3218
- setPage(page);
3219
- },
3220
- renderHref: (p)=>`?page=${p}`,
3221
- className: "ds-l-col--12 ds-u-padding-x--0"
3222
- })
3321
+ text,
3322
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3323
+ className: "fa fa-xmark ds-u-font-size--sm ds-u-margin-left--1"
3223
3324
  })
3224
3325
  ]
3225
3326
  });
3226
- else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
3227
- "aria-valuetext": "Dataset loading",
3228
- role: "status",
3229
- className: "ds-u-margin--3"
3230
- });
3231
3327
  };
3232
- var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
3328
+ var $c5b172e8d1a8197c$export$2e2bcd8739ae039 = $c5b172e8d1a8197c$var$FliterChip;
3329
+
3330
+
3233
3331
 
3234
3332
 
3235
- const $16bd41951b91f02d$var$FullScreenDataTable = ({ modalOpen: modalOpen, setModalOpen: setModalOpen })=>{
3333
+
3334
+
3335
+
3336
+
3337
+ const $dae856e97a09bcd6$var$DisplaySettings = ()=>{
3338
+ const { resource: resource } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
3339
+ const { setPage: setPage, tableDensity: tableDensity, setTableDensity: setTableDensity } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
3340
+ const rowOptions = [
3341
+ 10,
3342
+ 25,
3343
+ 50,
3344
+ 100
3345
+ ];
3346
+ if (!resource) return null;
3347
+ const { limit: limit, setLimit: setLimit, setOffset: setOffset } = resource;
3236
3348
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3237
- className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
3238
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dialog), {
3239
- heading: "Dataset Explorer",
3240
- isOpen: modalOpen,
3241
- onExit: ()=>setModalOpen(false),
3242
- className: "dkan-full-screen-dataset-dialog",
3243
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
3244
- isModal: true,
3245
- closeFullScreenModal: ()=>setModalOpen(false)
3246
- })
3349
+ className: "dkan-display-settings-wrapper",
3350
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
3351
+ className: "dkan-filter-dataset-toolbar-button ds-u-display--flex ds-u-align-items--center ds-u-color--primary ds-u-border--0 ds-u-padding--0 ds-u-padding-x--2 ds-u-margin--0 ds-u-fill--transparent ds-u-font-size--sm",
3352
+ activeClassName: "dkan-data-table-display-settings-tooltip-open",
3353
+ dialog: true,
3354
+ offset: [
3355
+ 0,
3356
+ 5
3357
+ ],
3358
+ placement: "bottom-start",
3359
+ maxWidth: "350px",
3360
+ "aria-label": "Display Settings",
3361
+ title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3362
+ className: "ds-u-display--flex ds-u-flex-direction--column",
3363
+ children: [
3364
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3365
+ className: "dkan-data-table-display-settings-row ds-u-padding-bottom--1",
3366
+ children: [
3367
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3368
+ className: "",
3369
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3370
+ className: "ds-u-font-size--md ds-u-font-weight--normal",
3371
+ children: "Row height"
3372
+ })
3373
+ }),
3374
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3375
+ className: "ds-u-display--flex ds-u-align-items--start",
3376
+ children: [
3377
+ /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
3378
+ onClick: ()=>setTableDensity("expanded"),
3379
+ "aria-label": "Row height, Expanded",
3380
+ className: `dkan-table-density-button ds-u-leading--reset ds-u-padding--1 ds-u-margin--0 ${tableDensity === "expanded" ? "active ds-u-fill--primary-lightest" : ""}`,
3381
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3382
+ className: "ds-u-display--block",
3383
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
3384
+ className: "ds-u-display--block",
3385
+ viewBox: "0 0 512 512",
3386
+ xmlns: "http://www.w3.org/2000/svg",
3387
+ "aria-hidden": "true",
3388
+ focusable: "false",
3389
+ height: "16",
3390
+ role: "img",
3391
+ width: "16",
3392
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3393
+ d: "M496,384 C504.836556,384 512,391.163444 512,400 L512,496 C512,504.836556 504.836556,512 496,512 L16,512 C7.163444,512 1.082166e-15,504.836556 0,496 L0,400 C-1.082166e-15,391.163444 7.163444,384 16,384 L496,384 Z M496,192 C504.836556,192 512,199.163444 512,208 L512,304 C512,312.836556 504.836556,320 496,320 L16,320 C7.163444,320 1.082166e-15,312.836556 0,304 L0,208 C-1.082166e-15,199.163444 7.163444,192 16,192 L496,192 Z M496,0 C504.836556,-1.623249e-15 512,7.163444 512,16 L512,112 C512,120.836556 504.836556,128 496,128 L16,128 C7.163444,128 1.082166e-15,120.836556 0,112 L0,16 C-1.082166e-15,7.163444 7.163444,1.623249e-15 16,0 L496,0 Z"
3394
+ })
3395
+ })
3396
+ })
3397
+ }),
3398
+ /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
3399
+ onClick: ()=>setTableDensity("normal"),
3400
+ "aria-label": "Row height, Normal",
3401
+ className: `dkan-table-density-button ds-u-leading--reset ds-u-padding--1 ds-u-margin--0 ${tableDensity === "normal" ? "active ds-u-fill--primary-lightest" : ""}`,
3402
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3403
+ className: "ds-u-display--block",
3404
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
3405
+ className: "ds-u-display--block",
3406
+ viewBox: "0 0 512 512",
3407
+ xmlns: "http://www.w3.org/2000/svg",
3408
+ "aria-hidden": "true",
3409
+ focusable: "false",
3410
+ height: "16",
3411
+ role: "img",
3412
+ width: "16",
3413
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3414
+ d: "M496,416 C504.836556,416 512,423.163444 512,432 L512,496 C512,504.836556 504.836556,512 496,512 L16,512 C7.163444,512 1.082166e-15,504.836556 0,496 L0,432 C-1.082166e-15,423.163444 7.163444,416 16,416 L496,416 Z M496,277 C504.836556,277 512,284.163444 512,293 L512,357 C512,365.836556 504.836556,373 496,373 L16,373 C7.163444,373 1.082166e-15,365.836556 0,357 L0,293 C-1.082166e-15,284.163444 7.163444,277 16,277 L496,277 Z M496,139 C504.836556,139 512,146.163444 512,155 L512,219 C512,227.836556 504.836556,235 496,235 L16,235 C7.163444,235 1.082166e-15,227.836556 0,219 L0,155 C-1.082166e-15,146.163444 7.163444,139 16,139 L496,139 Z M496,0 C504.836556,-1.623249e-15 512,7.163444 512,16 L512,80 C512,88.836556 504.836556,96 496,96 L16,96 C7.163444,96 1.082166e-15,88.836556 0,80 L0,16 C-1.082166e-15,7.163444 7.163444,1.623249e-15 16,0 L496,0 Z"
3415
+ })
3416
+ })
3417
+ })
3418
+ }),
3419
+ /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
3420
+ onClick: ()=>setTableDensity("compact"),
3421
+ "aria-label": "Row height, Compact",
3422
+ className: `dkan-table-density-button ds-u-leading--reset ds-u-padding--1 ds-u-margin--0 ${tableDensity === "compact" ? "active ds-u-fill--primary-lightest " : ""}`,
3423
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3424
+ className: "ds-u-display--block",
3425
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
3426
+ className: "ds-u-display--block",
3427
+ viewBox: "0 0 512 512",
3428
+ xmlns: "http://www.w3.org/2000/svg",
3429
+ "aria-hidden": "true",
3430
+ focusable: "false",
3431
+ height: "16",
3432
+ role: "img",
3433
+ width: "16",
3434
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
3435
+ d: "M496,448 C504.836556,448 512,455.163444 512,464 L512,496 C512,504.836556 504.836556,512 496,512 L16,512 C7.163444,512 1.082166e-15,504.836556 0,496 L0,464 C-1.082166e-15,455.163444 7.163444,448 16,448 L496,448 Z M496,336 C504.836556,336 512,343.163444 512,352 L512,384 C512,392.836556 504.836556,400 496,400 L16,400 C7.163444,400 1.082166e-15,392.836556 0,384 L0,352 C-1.082166e-15,343.163444 7.163444,336 16,336 L496,336 Z M496,224 C504.836556,224 512,231.163444 512,240 L512,272 C512,280.836556 504.836556,288 496,288 L16,288 C7.163444,288 1.082166e-15,280.836556 0,272 L0,240 C-1.082166e-15,231.163444 7.163444,224 16,224 L496,224 Z M496,112 C504.836556,112 512,119.163444 512,128 L512,160 C512,168.836556 504.836556,176 496,176 L16,176 C7.163444,176 1.082166e-15,168.836556 0,160 L0,128 C-1.082166e-15,119.163444 7.163444,112 16,112 L496,112 Z M496,0 C504.836556,-1.623249e-15 512,7.163444 512,16 L512,48 C512,56.836556 504.836556,64 496,64 L16,64 C7.163444,64 1.082166e-15,56.836556 0,48 L0,16 C-1.082166e-15,7.163444 7.163444,1.623249e-15 16,0 L496,0 Z"
3436
+ })
3437
+ })
3438
+ })
3439
+ })
3440
+ ]
3441
+ })
3442
+ ]
3443
+ }),
3444
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3445
+ className: "dkan-data-table-display-settings-row ds-u-border-top--1 ds-u-padding-top--1",
3446
+ children: [
3447
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3448
+ className: "",
3449
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3450
+ className: "ds-u-font-size--md ds-u-font-weight--normal",
3451
+ children: "Rows per page"
3452
+ })
3453
+ }),
3454
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3455
+ className: "",
3456
+ options: rowOptions.map((row)=>({
3457
+ label: row.toString(),
3458
+ value: row
3459
+ })),
3460
+ size: "medium",
3461
+ label: "Rows per page:",
3462
+ labelClassName: "ds-u-margin-top--0 ds-u-font-size--md ds-u-font-weight--normal",
3463
+ name: "datatable_rows_per_page",
3464
+ onChange: (e)=>{
3465
+ setLimit(parseInt(e.target.value));
3466
+ setPage(1);
3467
+ setOffset(0);
3468
+ },
3469
+ value: limit.toString(),
3470
+ defaultValue: limit.toString()
3471
+ })
3472
+ ]
3473
+ })
3474
+ ]
3475
+ }),
3476
+ children: [
3477
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3478
+ className: "far fa-sliders-h ds-u-margin-right--1"
3479
+ }),
3480
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3481
+ className: "ds-u-display--none ds-u-lg-display--inline-block",
3482
+ children: "Display Settings"
3483
+ }),
3484
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3485
+ className: "fa fa-chevron-down ds-u-margin-left--1 ds-u-font-weight--bold"
3486
+ }),
3487
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3488
+ className: "fa fa-chevron-up ds-u-margin-left--1 ds-u-font-weight--bold"
3489
+ })
3490
+ ]
3247
3491
  })
3248
3492
  });
3249
3493
  };
3250
- var $16bd41951b91f02d$export$2e2bcd8739ae039 = $16bd41951b91f02d$var$FullScreenDataTable;
3494
+ var $dae856e97a09bcd6$export$2e2bcd8739ae039 = $dae856e97a09bcd6$var$DisplaySettings;
3251
3495
 
3252
3496
 
3253
- const $71b4324f265dec16$var$DataTableControls = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
3254
- const [manageColumnsModalOpen, setManageColumnsModalOpen] = (0, $hgUW1$useState)(false);
3255
- const [fullScreenModalOpen, setFullScreenModalOpen] = (0, $hgUW1$useState)(false);
3256
- const hiddenColumns = columns.filter((c)=>c.getIsVisible() === false).length;
3257
- return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3497
+
3498
+ const $85f8ff1ff89899c7$var$updateBrowserURL = (newConditions)=>{
3499
+ const url = new URL(window.location.href);
3500
+ const urlString = (0, $hgUW1$qs).stringify({
3501
+ conditions: newConditions
3502
+ }, {
3503
+ encodeValuesOnly: true,
3504
+ addQueryPrefix: true
3505
+ });
3506
+ window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
3507
+ };
3508
+ const $85f8ff1ff89899c7$var$DataTableToolbar = ({ resource: resource, id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, isModal: isModal, closeFullScreenModal: closeFullScreenModal, datasetTableControls: datasetTableControls, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility })=>{
3509
+ const { limit: limit, offset: offset, count: count, conditions: conditions, setConditions: setConditions } = resource;
3510
+ const intCount = count ? count : 0;
3511
+ const hiddenColumns = Object.keys(columnVisibility).filter((key)=>columnVisibility[key] === false).length;
3512
+ const resetColumnVisibility = ()=>{
3513
+ const columns = {
3514
+ ...columnVisibility
3515
+ };
3516
+ for(let key in columns)if (columns[key] === false) columns[key] = true;
3517
+ setColumnVisibility(columns);
3518
+ // save to localStorage
3519
+ const currentLocalStorage = JSON.parse(localStorage.getItem(id));
3520
+ const updatedLocalStorageData = {
3521
+ ...currentLocalStorage,
3522
+ tableColumnVisibility: columns
3523
+ };
3524
+ localStorage.setItem(id, JSON.stringify(updatedLocalStorageData));
3525
+ };
3526
+ const removeCondition = (index)=>{
3527
+ // just removes the condition from the UI - "Apply Filters" must be clicked to change the data model
3528
+ let updatedConditions = JSON.parse(JSON.stringify(conditions));
3529
+ updatedConditions.splice(index, 1);
3530
+ setConditions(updatedConditions);
3531
+ $85f8ff1ff89899c7$var$updateBrowserURL(updatedConditions);
3532
+ };
3533
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3534
+ className: "ds-u-margin-top--2",
3258
3535
  children: [
3259
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3260
- className: "ds-u-border-top--1 ds-u-fill--gray-lightest ds-u-display--flex ds-u-justify-content--between",
3261
- children: [
3262
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3263
- children: hiddenColumns > 0 && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Alert), {
3264
- variation: "warn",
3536
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3537
+ className: "dkan-filter-dataset-toolbar ds-u-fill--white ds-u-border--1",
3538
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3539
+ className: "ds-l-col--12 ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center ds-u-flex-wrap--wrap ds-u-padding-x--0 ds-u-padding-y--2",
3540
+ children: [
3541
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3542
+ className: "ds-u-padding-x--2",
3543
+ children: !resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
3544
+ totalRows: intCount,
3545
+ limit: limit,
3546
+ offset: offset,
3547
+ className: "data-table-results ds-u-margin--0 ds-u-font-size--sm ds-u-padding-y--0 ds-u-md-padding-y--1 ds-u-padding-bottom--2 ds-u-md-padding-bottom--0"
3548
+ })
3549
+ }),
3550
+ datasetTableControls && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3551
+ className: "dkan-data-table-toolbar-controls ds-u-display--flex ds-u-flex-wrap--wrap ds-u-align-items--center ds-l-md-col--auto ds-l-col--12 ds-u-padding-x--2 ds-u-padding-top--2 ds-u-md-padding-top--0",
3265
3552
  children: [
3266
- hiddenColumns,
3267
- " Columns Hidden"
3553
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6f4318b1e14124e5$export$2e2bcd8739ae039), {}),
3554
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5d9e2ce238d53d29$export$2e2bcd8739ae039), {
3555
+ id: id,
3556
+ columns: columns,
3557
+ defaultColumnOrder: defaultColumnOrder
3558
+ }),
3559
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $dae856e97a09bcd6$export$2e2bcd8739ae039), {}),
3560
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $16bd41951b91f02d$export$2e2bcd8739ae039), {
3561
+ isModal: isModal,
3562
+ closeFullScreenModal: closeFullScreenModal
3563
+ })
3268
3564
  ]
3269
3565
  })
3566
+ ]
3567
+ })
3568
+ }),
3569
+ (conditions.length > 0 || hiddenColumns > 0) && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3570
+ className: "ds-u-fill--white ds-u-padding-x--0 ds-u-md-padding-x--2 ds-u-padding-top--2",
3571
+ children: [
3572
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
3573
+ className: "ds-u-margin--0 ds-u-margin-bottom--2 ds-u-font-size--lg ds-u-font-weight--bold",
3574
+ children: "Selected filters"
3270
3575
  }),
3271
3576
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3577
+ className: "ds-u-display--flex ds-u-justify-content--between ds-u-md-align-items--end ds-u-flex-direction--column ds-u-md-flex-direction--row",
3272
3578
  children: [
3273
- /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
3274
- "aria-label": "Manage columns - Opens in a dialog",
3275
- className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
3276
- onClick: ()=>{
3277
- setManageColumnsModalOpen(true);
3278
- },
3579
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3580
+ className: "ds-u-display--flex ds-u-padding-right--0 ds-u-md-padding-right--4 ds-u-flex-wrap--wrap",
3279
3581
  children: [
3280
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3281
- className: "far fa-cog ds-u-margin-right--1"
3282
- }),
3283
- "Manage Columns"
3582
+ conditions.length > 0 ? conditions.map((condition, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $c5b172e8d1a8197c$export$2e2bcd8739ae039), {
3583
+ iconClass: "far fa-filter",
3584
+ text: `"${condition.property}" ${condition.operator} ${condition.value}`,
3585
+ onClick: ()=>{
3586
+ removeCondition(index);
3587
+ }
3588
+ }, index)) : null,
3589
+ hiddenColumns > 0 ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $c5b172e8d1a8197c$export$2e2bcd8739ae039), {
3590
+ iconClass: "fa fa-columns",
3591
+ text: `${hiddenColumns} Column${hiddenColumns === 1 ? "" : "s"} Hidden`,
3592
+ onClick: ()=>{
3593
+ resetColumnVisibility();
3594
+ }
3595
+ }) : null
3284
3596
  ]
3285
3597
  }),
3286
- /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
3287
- "aria-label": isModal ? "Close Full Screen dialog" : "Full Screen mode - Opens in a dialog",
3288
- className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
3289
- onClick: ()=>{
3290
- if (isModal) closeFullScreenModal();
3291
- else setFullScreenModalOpen(true);
3292
- },
3293
- children: [
3294
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3295
- className: `fa ${isModal ? "fa-compress" : "fa-expand"} ds-u-margin-right--1`
3296
- }),
3297
- isModal ? "Exit Full Screen" : "Full Screen"
3298
- ]
3598
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3599
+ className: "ds-l-col--auto ds-u-padding--0 ds-u-display--flex ds-u-justify-content--end",
3600
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
3601
+ className: "dkan-clear-all-filters-button ds-u-color--primary ds-u-font-size--md ds-u-font-weight--bold ds-u-border--0 ds-u-padding--0 ds-u-margin--0 ds-u-fill--transparent ds-u-text-decoration--underline ds-u-margin-bottom--1",
3602
+ onClick: ()=>{
3603
+ setConditions([]);
3604
+ $85f8ff1ff89899c7$var$updateBrowserURL([]);
3605
+ resetColumnVisibility();
3606
+ },
3607
+ children: "Clear all filters"
3608
+ })
3299
3609
  })
3300
3610
  ]
3301
3611
  })
3302
3612
  ]
3303
- }),
3304
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3305
- children: [
3306
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5d9e2ce238d53d29$export$2e2bcd8739ae039), {
3307
- id: id,
3308
- columns: columns,
3309
- defaultColumnOrder: defaultColumnOrder,
3310
- modalOpen: manageColumnsModalOpen,
3311
- setModalOpen: setManageColumnsModalOpen
3312
- }),
3313
- !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $16bd41951b91f02d$export$2e2bcd8739ae039), {
3314
- modalOpen: fullScreenModalOpen,
3315
- setModalOpen: setFullScreenModalOpen
3316
- })
3317
- ]
3318
3613
  })
3319
3614
  ]
3320
3615
  });
3321
3616
  };
3322
- var $71b4324f265dec16$export$2e2bcd8739ae039 = $71b4324f265dec16$var$DataTableControls;
3617
+ var $85f8ff1ff89899c7$export$2e2bcd8739ae039 = $85f8ff1ff89899c7$var$DataTableToolbar;
3323
3618
 
3324
3619
 
3325
-
3326
-
3327
- const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
3328
- const { id: id, resource: resource, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
3329
- const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $ebda441784d176a5$export$2e2bcd8739ae039));
3620
+ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal, downloadURL: downloadURL, unfilteredDownloadURL: unfilteredDownloadURL, setPage: setPage, showCopyLinkButton: showCopyLinkButton, showDownloadFilteredDataButton: showDownloadFilteredDataButton, showDownloadFullDataButton: showDownloadFullDataButton, showStoredQueryDownloadButton: showStoredQueryDownloadButton })=>{
3621
+ const { id: id, resource: resource, datasetTableControls: datasetTableControls, dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
3622
+ const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
3623
+ const { conditions: conditions } = resource;
3330
3624
  const data = resource.values;
3331
3625
  const [sorting, setSorting] = (0, $hgUW1$useState)([]);
3332
3626
  const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
@@ -3388,17 +3682,142 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sort
3388
3682
  ]);
3389
3683
  return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3390
3684
  children: [
3391
- datasetTableControls && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3392
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $71b4324f265dec16$export$2e2bcd8739ae039), {
3393
- id: id,
3394
- columns: table.getAllLeafColumns(),
3395
- defaultColumnOrder: defaultColumnOrder,
3396
- isModal: isModal,
3397
- closeFullScreenModal: closeFullScreenModal
3685
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3686
+ className: "ds-u-margin-bottom--3",
3687
+ children: showDownloadFullDataButton && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3688
+ className: "dkan-data-table-download-full-dataset-button ds-u-fill--primary ds-u-color--white ds-u-text-align--center ds-u-padding-x--3 ds-u-margin-x--0 ds-u-margin-y--0",
3689
+ href: unfilteredDownloadURL,
3690
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3691
+ className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-margin-x--0 ds-u-padding--0",
3692
+ children: [
3693
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3694
+ className: "fas fa-file-csv"
3695
+ }),
3696
+ " Download full dataset (CSV)"
3697
+ ]
3698
+ })
3398
3699
  })
3399
3700
  }),
3701
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $85f8ff1ff89899c7$export$2e2bcd8739ae039), {
3702
+ id: id,
3703
+ columns: table.getAllLeafColumns(),
3704
+ defaultColumnOrder: defaultColumnOrder,
3705
+ isModal: isModal,
3706
+ closeFullScreenModal: closeFullScreenModal,
3707
+ resource: resource,
3708
+ datasetTableControls: datasetTableControls,
3709
+ columnVisibility: columnVisibility,
3710
+ setColumnVisibility: setColumnVisibility
3711
+ }),
3712
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3713
+ className: "ds-u-display--flex ds-l-col--12 ds-l-md-col--11 ds-u-justify-content--between ds-u-padding--0 ds-u-margin-y--2 ds-u-md-margin-y--3 ds-u-flex-direction--column ds-u-md-flex-direction--row",
3714
+ children: [
3715
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3716
+ className: "dkan-data-table-info-container ds-u-padding-right--0 ds-u-md-padding-right--4",
3717
+ children: [
3718
+ dataDictionaryBanner && !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3719
+ className: "ds-u-margin-bottom--3",
3720
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3721
+ children: 'Click on the "Data Dictionary" tab above for full column definitions'
3722
+ })
3723
+ }),
3724
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
3725
+ className: "ds-u-margin--0",
3726
+ children: "Activate the column resize button and use the right and left arrow keys to resize a column or use your mouse to drag/resize. Press escape to cancel the resizing."
3727
+ })
3728
+ ]
3729
+ }),
3730
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3731
+ className: "dkan-data-table-share-container ds-l-col--auto ds-u-padding--0 ds-u-margin-bottom--2 ds-u-md-margin-bottom--0",
3732
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
3733
+ className: "dkan-data-table-share-button ds-u-display--flex ds-u-align-items--center ds-u-fill--primary ds-u-radius--pill ds-u-color--white ds-u-border--0 ds-u-padding-x--3 ds-u-padding-y--1 ds-u-font-weight--bold ds-l-col--12 ds-l-md-col--auto ds-u-justify-content--center",
3734
+ activeClassName: "dkan-data-table-share-tooltip-open",
3735
+ dialog: true,
3736
+ offset: [
3737
+ 0,
3738
+ 5
3739
+ ],
3740
+ placement: "bottom-start",
3741
+ maxWidth: "320px",
3742
+ title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3743
+ className: "dc-c-resource-header--buttons ds-u-display--flex ds-u-flex-direction--column ds-l-col--12 ds-u-padding-x--0",
3744
+ children: [
3745
+ showCopyLinkButton && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
3746
+ children: conditions && conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
3747
+ onOpen: ()=>{
3748
+ navigator.clipboard.writeText(window.location.href);
3749
+ },
3750
+ className: "dkan-data-table-download-button ds-c-button ds-u-text-align--center ds-l-col--12 ds-u-padding-x--2 ds-u-margin-x--0 ds-u-margin-bottom--1",
3751
+ placement: "bottom",
3752
+ dialog: true,
3753
+ ariaLabel: "Copy link to filtered data",
3754
+ title: "Link copied to clipboard",
3755
+ "aria-disabled": !conditions || conditions.length === 0,
3756
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3757
+ className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-margin-x--0 ds-u-padding--0",
3758
+ children: [
3759
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3760
+ className: "fas fa-copy"
3761
+ }),
3762
+ " Copy link to filtered data"
3763
+ ]
3764
+ })
3765
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3766
+ "aria-disabled": true,
3767
+ "aria-label": "Copy link to filtered data",
3768
+ className: "dkan-data-table-download-button ds-c-button ds-u-text-align--center ds-l-col--12 ds-u-padding-x--2 ds-u-margin-x--0 ds-u-margin-bottom--1",
3769
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3770
+ className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-padding--0",
3771
+ children: [
3772
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3773
+ className: "fas fa-copy"
3774
+ }),
3775
+ " Copy link to filtered data"
3776
+ ]
3777
+ })
3778
+ })
3779
+ }),
3780
+ (showDownloadFilteredDataButton || showStoredQueryDownloadButton) && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3781
+ className: "ds-l-col--12 ds-u-padding-x--0 ds-u-margin-x--0",
3782
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3783
+ className: "dkan-data-table-download-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12 ds-u-padding-x--2 ds-u-margin-x--0 ds-u-margin-bottom--1",
3784
+ href: downloadURL,
3785
+ "aria-disabled": !conditions || conditions.length === 0,
3786
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3787
+ className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-padding--0",
3788
+ children: [
3789
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3790
+ className: "fas fa-file-csv"
3791
+ }),
3792
+ " ",
3793
+ showDownloadFilteredDataButton ? `Download filtered data (CSV)` : `Download stored query data (CSV)`
3794
+ ]
3795
+ })
3796
+ })
3797
+ })
3798
+ ]
3799
+ }),
3800
+ children: [
3801
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3802
+ className: "far fa-share-alt"
3803
+ }),
3804
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
3805
+ className: "ds-u-margin-x--05",
3806
+ children: "Share"
3807
+ }),
3808
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3809
+ className: "fa fa-chevron-down"
3810
+ }),
3811
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3812
+ className: "fa fa-chevron-up"
3813
+ })
3814
+ ]
3815
+ })
3816
+ })
3817
+ ]
3818
+ }),
3400
3819
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3401
- className: "dc-c-datatable-wrapper",
3820
+ className: "dc-c-datatable-wrapper ds-u-border-x--1 ds-u-border-bottom--1",
3402
3821
  tabIndex: 0,
3403
3822
  ref: dataTableWrapperElement,
3404
3823
  children: [
@@ -3960,61 +4379,6 @@ var $5723016a5461c1ca$export$2e2bcd8739ae039 = $5723016a5461c1ca$var$PageHeader;
3960
4379
 
3961
4380
 
3962
4381
 
3963
- function $eff7d34c30f5a0fc$export$959638e8dca60ce6(facets) {
3964
- let facetObj = {};
3965
- if (facets) {
3966
- facets.forEach((f)=>{
3967
- if (facetObj[f.type]) facetObj[f.type] = [
3968
- ...facetObj[f.type],
3969
- f
3970
- ];
3971
- else facetObj[f.type] = [
3972
- f
3973
- ];
3974
- });
3975
- // sort facets descending by int value, put non int last
3976
- if (facetObj.keyword) facetObj.keyword.sort((a, b)=>{
3977
- if (Number(a.name) && Number(b.name)) return Number(b.name) - Number(a.name);
3978
- });
3979
- return facetObj;
3980
- }
3981
- }
3982
- function $eff7d34c30f5a0fc$export$60ec7cc1d341a524(searchParams, defaultSortOptions) {
3983
- const params = (0, $hgUW1$qs).parse(searchParams, {
3984
- ignoreQueryPrefix: true
3985
- });
3986
- let themes = params.theme;
3987
- let keywords = params.keyword;
3988
- return {
3989
- page: params.page,
3990
- sort: !params.sort ? defaultSortOptions.defaultSort : params.sort,
3991
- sortOrder: !params.sortOrder ? defaultSortOptions.defaultOrder : params.sortOrder,
3992
- fulltext: params.fulltext,
3993
- selectedFacets: {
3994
- theme: themes ? themes : [],
3995
- keyword: keywords ? keywords : []
3996
- }
3997
- };
3998
- }
3999
- async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, ACA) {
4000
- const { fulltext: fulltext, selectedFacets: selectedFacets, sort: sort, sortOrder: sortOrder, page: page, pageSize: pageSize } = options;
4001
- let params = {
4002
- fulltext: fulltext ? fulltext : undefined,
4003
- ...selectedFacets,
4004
- sort: sort ? sort : undefined,
4005
- ["sort-order"]: sortOrder ? sortOrder : undefined,
4006
- page: page !== 1 ? page : undefined,
4007
- ["page-size"]: pageSize !== 10 ? pageSize : undefined
4008
- };
4009
- return await (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA), {
4010
- arrayFormat: "comma",
4011
- encode: false
4012
- })}`);
4013
- }
4014
-
4015
-
4016
-
4017
-
4018
4382
 
4019
4383
  const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
4020
4384
  const { rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
@@ -4415,10 +4779,11 @@ var $e873081a6e8f024e$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
4415
4779
 
4416
4780
 
4417
4781
 
4418
- const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
4419
- defaultSort: "modified",
4420
- defaultOrder: "desc"
4421
- }, pageTitle: pageTitle = "What's New ", showLargeFileWarning: showLargeFileWarning = false, introText: introText = "", dataDictionaryLinks: dataDictionaryLinks = false })=>{
4782
+ const $550bcc185f420ff5$var$DatasetList = (props)=>{
4783
+ const { rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
4784
+ defaultSort: "modified",
4785
+ defaultOrder: "desc"
4786
+ }, pageTitle: pageTitle = "What's New ", showLargeFileWarning: showLargeFileWarning = false, introText: introText = "", dataDictionaryLinks: dataDictionaryLinks = false } = props;
4422
4787
  const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
4423
4788
  const sortOptions = [
4424
4789
  {
@@ -4550,26 +4915,29 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
4550
4915
  children: [
4551
4916
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4552
4917
  className: "ds-l-row",
4553
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4918
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4554
4919
  className: "ds-l-col--12",
4555
- children: showLargeFileWarning && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4556
- className: "ds-l-row ds-u-margin-bottom--2 ds-u-margin-top--4",
4557
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4558
- className: "ds-l-md-col--12",
4559
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
4560
- bordered: true,
4561
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
4562
- contentClassName: "downloading-datasets",
4563
- heading: "Please read before downloading datasets",
4564
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3b2d31a9c6cd2284$export$2e2bcd8739ae039), {})
4920
+ children: [
4921
+ introText ? introText : null,
4922
+ showLargeFileWarning && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4923
+ className: "ds-l-row ds-u-margin-bottom--2 ds-u-margin-top--4",
4924
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4925
+ className: "ds-l-md-col--12",
4926
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
4927
+ bordered: true,
4928
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
4929
+ contentClassName: "downloading-datasets",
4930
+ heading: "Please read before downloading datasets",
4931
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3b2d31a9c6cd2284$export$2e2bcd8739ae039), {})
4932
+ })
4565
4933
  })
4566
4934
  })
4567
4935
  })
4568
- })
4936
+ ]
4569
4937
  })
4570
4938
  }),
4571
4939
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4572
- className: "ds-l-row",
4940
+ className: "ds-l-row ds-u-padding-top--4",
4573
4941
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4574
4942
  className: "ds-l-col--12",
4575
4943
  children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
@@ -4581,40 +4949,32 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
4581
4949
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4582
4950
  className: "ds-u-display--flex ds-u-justify-content--between ds-u-align-items--end ds-u-flex-wrap--reverse ds-u-sm-flex-wrap--wrap",
4583
4951
  children: [
4584
- /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4952
+ enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4585
4953
  className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--8 ds-u-sm-padding-left--0",
4586
4954
  children: [
4587
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4588
- className: "ds-u-margin-bottom--3",
4589
- children: introText ? introText : null
4955
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4956
+ className: "ds-u-margin-y--0",
4957
+ "aria-hidden": "true",
4958
+ children: currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
4959
+ children: [
4960
+ "Showing ",
4961
+ currentResultNumbers.startingNumber,
4962
+ " -",
4963
+ " ",
4964
+ currentResultNumbers.endingNumber,
4965
+ " of ",
4966
+ data.data.total,
4967
+ " datasets"
4968
+ ]
4969
+ })
4590
4970
  }),
4591
- enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4592
- children: [
4593
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4594
- className: "ds-u-margin-y--0",
4595
- "aria-hidden": "true",
4596
- children: currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
4597
- children: [
4598
- "Showing ",
4599
- currentResultNumbers.startingNumber,
4600
- " -",
4601
- " ",
4602
- currentResultNumbers.endingNumber,
4603
- " of ",
4604
- data.data.total,
4605
- " datasets"
4606
- ]
4607
- })
4608
- }),
4609
- /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4610
- className: "ds-u-visibility--screen-reader",
4611
- role: "status",
4612
- "aria-live": "assertive",
4613
- "aria-atomic": "true",
4614
- "data-testid": "currentResults",
4615
- children: announcementText
4616
- })
4617
- ]
4971
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4972
+ className: "ds-u-visibility--screen-reader",
4973
+ role: "status",
4974
+ "aria-live": "assertive",
4975
+ "aria-atomic": "true",
4976
+ "data-testid": "currentResults",
4977
+ children: announcementText
4618
4978
  })
4619
4979
  ]
4620
4980
  }),
@@ -4633,7 +4993,7 @@ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enabl
4633
4993
  }),
4634
4994
  /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
4635
4995
  className: "dc-dataset-search-list ds-u-padding--0 ds-u-margin-top--0 ds-u-margin-bottom--4 ds-u-display--block",
4636
- "data-testid": "datasetlist-results-list",
4996
+ "data-testid": "results-list",
4637
4997
  children: [
4638
4998
  noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
4639
4999
  variation: "error",
@@ -4695,6 +5055,7 @@ var $550bcc185f420ff5$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
4695
5055
 
4696
5056
 
4697
5057
 
5058
+
4698
5059
  const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl)=>{
4699
5060
  const [dataset, setDataset] = (0, $hgUW1$useState)({
4700
5061
  title: "",
@@ -5844,32 +6205,9 @@ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
5844
6205
 
5845
6206
 
5846
6207
 
5847
-
5848
- const $39bc4d98030a5599$var$DataTableStateWrapper = ({ showQueryBuilder: showQueryBuilder = true, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
5849
- const { id: id, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
5850
- // a wrapper component to keep column state synced between full screen and regular modes
5851
- const localStorageData = id ? JSON.parse(localStorage.getItem(id)) : null;
5852
- const defaultPage = 1;
5853
- const [page, setPage] = (0, $hgUW1$useState)(defaultPage);
5854
- const [columnOrder, setColumnOrder] = (0, $hgUW1$useState)(()=>{
5855
- if (datasetTableControls && localStorageData) return localStorageData.tableColumnOrder;
5856
- else return [];
5857
- });
5858
- const [columnVisibility, setColumnVisibility] = (0, $hgUW1$useState)(()=>{
5859
- if (datasetTableControls && localStorageData) return localStorageData.tableColumnVisibility;
5860
- else return {};
5861
- });
5862
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ebda441784d176a5$export$2e2bcd8739ae039).Provider, {
5863
- value: {
5864
- columnOrder: columnOrder,
5865
- setColumnOrder: setColumnOrder,
5866
- columnVisibility: columnVisibility,
5867
- setColumnVisibility: setColumnVisibility,
5868
- page: page,
5869
- setPage: setPage
5870
- },
6208
+ const $39bc4d98030a5599$var$DataTableStateWrapper = ({ showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
6209
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee0d4d4f34048447$export$2e2bcd8739ae039), {
5871
6210
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
5872
- showQueryBuilder: showQueryBuilder,
5873
6211
  showCopyLinkButton: showCopyLinkButton,
5874
6212
  showDownloadFilteredDataButton: showDownloadFilteredDataButton,
5875
6213
  showDownloadFullDataButton: showDownloadFullDataButton,
@@ -6967,7 +7305,6 @@ function $8b67b7ee3fcfb629$export$2e2bcd8739ae039({ id: id, rootUrl: rootUrl, cu
6967
7305
  datasetTableControls: !disableTableControls
6968
7306
  },
6969
7307
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {
6970
- showQueryBuilder: false,
6971
7308
  showCopyLinkButton: false,
6972
7309
  showDownloadFilteredDataButton: false,
6973
7310
  showDownloadFullDataButton: false,
@@ -7117,6 +7454,78 @@ var $374c4669b044ddf8$export$2e2bcd8739ae039 = $374c4669b044ddf8$var$QueryRow;
7117
7454
 
7118
7455
 
7119
7456
 
7457
+
7458
+ const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
7459
+ const { fields: fields } = schema;
7460
+ const prependedMessage = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
7461
+ children: "Data filters: "
7462
+ });
7463
+ if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
7464
+ className: "ds-u-margin-y--0",
7465
+ children: [
7466
+ prependedMessage,
7467
+ " none"
7468
+ ]
7469
+ });
7470
+ function formatValue(text, property) {
7471
+ if (customColumns && customColumns.length > 0) {
7472
+ let newValue = text;
7473
+ let customColumn = customColumns.find((c)=>c.accessor === property);
7474
+ if (customColumn && customColumn.cell) return customColumn.cell({
7475
+ value: text
7476
+ });
7477
+ return text;
7478
+ } else return text;
7479
+ }
7480
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
7481
+ className: "dc-querybuilder-title",
7482
+ children: [
7483
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
7484
+ className: "ds-u-margin-y--0",
7485
+ children: prependedMessage
7486
+ }),
7487
+ conditions.map((c)=>{
7488
+ const field = fields[c.property];
7489
+ const description = field && field.description ? field.description : c.property;
7490
+ const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
7491
+ const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
7492
+ const formattedText = formatValue(cleanedText, c.property);
7493
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
7494
+ className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
7495
+ children: [
7496
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
7497
+ className: "ds-u-font-weight--bold",
7498
+ children: description
7499
+ }),
7500
+ " ",
7501
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
7502
+ className: "ds-u-font-weight--normal",
7503
+ children: operator.label.toUpperCase()
7504
+ }),
7505
+ " ",
7506
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
7507
+ className: "ds-u-color--success",
7508
+ children: formattedText
7509
+ })
7510
+ ]
7511
+ });
7512
+ }).reduce((prev, curr)=>[
7513
+ prev,
7514
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
7515
+ className: "ds-u-margin-x--1",
7516
+ variation: "info",
7517
+ children: "AND"
7518
+ }),
7519
+ curr
7520
+ ])
7521
+ ]
7522
+ });
7523
+ };
7524
+ var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
7525
+
7526
+
7527
+
7528
+
7120
7529
  function $3b6ca952e79f0695$var$updateQueryForDatastore(condition) {
7121
7530
  let cond = condition;
7122
7531
  delete cond.key;
@@ -7632,5 +8041,5 @@ var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollTo
7632
8041
 
7633
8042
 
7634
8043
 
7635
- export {$e49d4387bed21287$export$2e2bcd8739ae039 as ApiRowLimitNotice, $a8accc31bf9e0bda$export$2e2bcd8739ae039 as CMSTopNav, $c49454ea7d1c4579$export$2e2bcd8739ae039 as ErrorBoundary, $046ded0064bd0a3d$export$2e2bcd8739ae039 as FAQAccordion, $b939b31651e82908$export$2e2bcd8739ae039 as HeaderNav, $1555e1cb3eb7b3e3$export$2e2bcd8739ae039 as HeaderNavIconLink, $fea9297ba4dd394c$export$2e2bcd8739ae039 as HeaderSearch, $9a8892c5ac150556$export$2e2bcd8739ae039 as HeaderSiteTitle, $3c72c298c3a7f21f$export$2e2bcd8739ae039 as HeaderTagline, $403833a4b442d5df$export$2e2bcd8739ae039 as MobileMenuButton, $f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $953b286f7778640e$export$2e2bcd8739ae039 as SidebarNavigation, $b0968edc60d7d3a4$export$2e2bcd8739ae039 as SidebarPage, $4f153ca537d853e5$export$2e2bcd8739ae039 as SubMenu, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $c068004d499082cc$export$2e2bcd8739ae039 as DatasetListItem, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $17711e94d2ce0ee4$export$2e2bcd8739ae039 as DatasetDateItem, $20de4fedf33d4f9a$export$2e2bcd8739ae039 as DatasetDate, $10bc3aae21fc1572$export$2e2bcd8739ae039 as DatasetListSubmenu, $789279954d8eff7f$export$2e2bcd8739ae039 as ApiDocumentation, $af099c546cb226c7$export$2e2bcd8739ae039 as ResourceHeader, $626282d9a03c51d5$export$2e2bcd8739ae039 as ResourcePreview, $072291d44ce1834a$export$2e2bcd8739ae039 as ResourceFooter, $ec3e23baa005dc03$export$2e2bcd8739ae039 as Breadcrumb, $bd76a91923d7e8a7$export$2e2bcd8739ae039 as TransformedDate, $d98f94c79ddf4e0e$export$2e2bcd8739ae039 as DataTable, $bdb071ea3a6d3466$export$2e2bcd8739ae039 as SearchInput, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults, $1a2bf34e2a8f6b80$export$59a943b34a82e690 as truncateText, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $550bcc185f420ff5$export$2e2bcd8739ae039 as DatasetList, $a0f13962e513caa1$export$2e2bcd8739ae039 as Dataset, $a35cf16d1488f54e$export$2e2bcd8739ae039 as DatasetTable, $b9af6ce5e2c06331$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $669d2782ec2e2250$export$2e2bcd8739ae039 as SpecsAndLimits, $8b67b7ee3fcfb629$export$2e2bcd8739ae039 as StoredQueryPage, $f61ecf9f84951a61$export$2e2bcd8739ae039 as FilteredResource, $bef7bff2823feea2$export$2e2bcd8739ae039 as QueryTitle, $7264a673914aa746$export$2b9377795161999 as buildOperatorOptions, $7264a673914aa746$export$e284ae5d89467c8f as convertUTCToLocalDate, $7264a673914aa746$export$6b5e57d20078142b as cleanText, $7264a673914aa746$export$8049e8f40a9bdfb8 as buildCustomColHeaders, $11500a65bd7d9cf1$export$2e2bcd8739ae039 as HeaderContext, $43a30d745a7bbc86$export$2e2bcd8739ae039 as DataTableContext, $ebda441784d176a5$export$2e2bcd8739ae039 as ManageColumnsContext, $844981eac9b63865$export$eccc29c8d0ff408 as ACAContext, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI, $1d3d480a9cfaabe0$export$2e2bcd8739ae039 as useDatastore, $aa4450dcbeef3ac0$export$385a5aba38cc3325 as transformTableSortToQuerySort, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $b4aa9c66f2e86959$export$2e2bcd8739ae039 as useMetastoreDataset, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 as withQueryProvider, $6d5c0212e738499b$export$34e95918366a058e as acaToParams, $6da0396069e23175$export$bc27cf7ecf44639d as defaultMetadataMapping};
8044
+ export {$e49d4387bed21287$export$2e2bcd8739ae039 as ApiRowLimitNotice, $a8accc31bf9e0bda$export$2e2bcd8739ae039 as CMSTopNav, $c49454ea7d1c4579$export$2e2bcd8739ae039 as ErrorBoundary, $046ded0064bd0a3d$export$2e2bcd8739ae039 as FAQAccordion, $b939b31651e82908$export$2e2bcd8739ae039 as HeaderNav, $1555e1cb3eb7b3e3$export$2e2bcd8739ae039 as HeaderNavIconLink, $fea9297ba4dd394c$export$2e2bcd8739ae039 as HeaderSearch, $9a8892c5ac150556$export$2e2bcd8739ae039 as HeaderSiteTitle, $3c72c298c3a7f21f$export$2e2bcd8739ae039 as HeaderTagline, $403833a4b442d5df$export$2e2bcd8739ae039 as MobileMenuButton, $f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $953b286f7778640e$export$2e2bcd8739ae039 as SidebarNavigation, $b0968edc60d7d3a4$export$2e2bcd8739ae039 as SidebarPage, $4f153ca537d853e5$export$2e2bcd8739ae039 as SubMenu, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $c068004d499082cc$export$2e2bcd8739ae039 as DatasetListItem, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $17711e94d2ce0ee4$export$2e2bcd8739ae039 as DatasetDateItem, $20de4fedf33d4f9a$export$2e2bcd8739ae039 as DatasetDate, $789279954d8eff7f$export$2e2bcd8739ae039 as ApiDocumentation, $af099c546cb226c7$export$2e2bcd8739ae039 as ResourceHeader, $626282d9a03c51d5$export$2e2bcd8739ae039 as ResourcePreview, $072291d44ce1834a$export$2e2bcd8739ae039 as ResourceFooter, $ec3e23baa005dc03$export$2e2bcd8739ae039 as Breadcrumb, $bd76a91923d7e8a7$export$2e2bcd8739ae039 as TransformedDate, $d98f94c79ddf4e0e$export$2e2bcd8739ae039 as DataTable, $bdb071ea3a6d3466$export$2e2bcd8739ae039 as SearchInput, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults, $1a2bf34e2a8f6b80$export$59a943b34a82e690 as truncateText, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $550bcc185f420ff5$export$2e2bcd8739ae039 as DatasetList, $9384a736d4d6f425$export$2e2bcd8739ae039 as DatasetListSubmenu, $a0f13962e513caa1$export$2e2bcd8739ae039 as Dataset, $a35cf16d1488f54e$export$2e2bcd8739ae039 as DatasetTable, $b9af6ce5e2c06331$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $669d2782ec2e2250$export$2e2bcd8739ae039 as SpecsAndLimits, $8b67b7ee3fcfb629$export$2e2bcd8739ae039 as StoredQueryPage, $f61ecf9f84951a61$export$2e2bcd8739ae039 as FilteredResource, $bef7bff2823feea2$export$2e2bcd8739ae039 as QueryTitle, $7264a673914aa746$export$2b9377795161999 as buildOperatorOptions, $7264a673914aa746$export$e284ae5d89467c8f as convertUTCToLocalDate, $7264a673914aa746$export$6b5e57d20078142b as cleanText, $7264a673914aa746$export$8049e8f40a9bdfb8 as buildCustomColHeaders, $11500a65bd7d9cf1$export$2e2bcd8739ae039 as HeaderContext, $43a30d745a7bbc86$export$2e2bcd8739ae039 as DataTableContext, $ee0d4d4f34048447$export$2e2bcd8739ae039 as DataTableActionsProvider, $844981eac9b63865$export$eccc29c8d0ff408 as ACAContext, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI, $1d3d480a9cfaabe0$export$2e2bcd8739ae039 as useDatastore, $aa4450dcbeef3ac0$export$385a5aba38cc3325 as transformTableSortToQuerySort, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $b4aa9c66f2e86959$export$2e2bcd8739ae039 as useMetastoreDataset, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 as withQueryProvider, $6d5c0212e738499b$export$34e95918366a058e as acaToParams, $6da0396069e23175$export$bc27cf7ecf44639d as defaultMetadataMapping};
7636
8045
  //# sourceMappingURL=main.js.map