@civicactions/cmsds-open-data-components 3.10.0-alpha.0 → 3.10.0-alpha.1

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, 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";
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";
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, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate} from "react-router-dom";
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";
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,7 +275,6 @@ var $11500a65bd7d9cf1$export$2e2bcd8739ae039 = $11500a65bd7d9cf1$var$HeaderConte
275
275
 
276
276
 
277
277
 
278
-
279
278
  const $61ff88fb3f6ee2c8$var$queryClient = new (0, $hgUW1$QueryClient)({
280
279
  defaultOptions: {
281
280
  queries: {
@@ -299,44 +298,25 @@ var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryPr
299
298
 
300
299
 
301
300
 
302
-
303
301
  const $4808982eba3feb88$var$DatasetListSubmenuItem = (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
- }
302
+ const { title: title, identifier: identifier, linkClasses: linkClasses } = props;
316
303
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
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
- })
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
330
311
  })
331
312
  })
332
- });
313
+ }, identifier);
333
314
  };
334
315
  var $4808982eba3feb88$export$2e2bcd8739ae039 = $4808982eba3feb88$var$DatasetListSubmenuItem;
335
316
 
336
317
 
337
318
 
338
319
 
339
-
340
320
  function $6d5c0212e738499b$export$34e95918366a058e(params, ACA) {
341
321
  if (ACA) params = Object.assign(params, {
342
322
  ACA: ACA,
@@ -346,136 +326,36 @@ function $6d5c0212e738499b$export$34e95918366a058e(params, ACA) {
346
326
  }
347
327
 
348
328
 
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
-
403
329
 
404
330
  const $844981eac9b63865$export$eccc29c8d0ff408 = (0, $hgUW1$createContext)({
405
331
  ACA: undefined
406
332
  });
407
333
 
408
334
 
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;
335
+ const $10bc3aae21fc1572$var$DatasetListSubmenu = ({ rootUrl: rootUrl, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 4, defaultSort: defaultSort = {
336
+ defaultSort: "modified",
337
+ defaultOrder: "desc"
338
+ }, subLinkClasses: subLinkClasses })=>{
414
339
  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);
420
340
  const [currentResultNumbers, setCurrentResultNumbers] = (0, $hgUW1$useState)({
421
341
  total: 0,
422
342
  startingNumber: 0,
423
343
  endingNumber: 0
424
344
  });
425
345
  const [noResults, setNoResults] = (0, $hgUW1$useState)(false);
426
- const [announcementText, setAnnouncementText] = (0, $hgUW1$useState)("");
427
- let [searchParams, setSearchParams] = (0, $hgUW1$useSearchParams)();
428
346
  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);
432
347
  const pageSize = defaultPageSize;
433
348
  (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);
449
349
  if (totalItems <= 0 && currentResultNumbers !== null) setNoResults(true);
450
350
  else setNoResults(false);
451
351
  }, [
452
352
  totalItems,
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
353
+ pageSize
463
354
  ]);
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
- }
474
355
  let params = {
475
- sort: sort ? sort : undefined,
476
- ["sort-order"]: sortOrder ? sortOrder : undefined,
477
- page: page !== 1 ? page : undefined,
478
- ["page-size"]: pageSize !== 10 ? pageSize : undefined
356
+ sort: defaultSort.defaultSort,
357
+ ["sort-order"]: defaultSort.defaultOrder,
358
+ ["page-size"]: defaultPageSize
479
359
  };
480
360
  const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
481
361
  queryKey: [
@@ -489,79 +369,97 @@ const $9384a736d4d6f425$var$DatasetListSubmenu = (props)=>{
489
369
  })}`);
490
370
  }
491
371
  });
492
- if (data && data.data.total && totalItems != data.data.total) setTotalItems(data.data.total);
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
+ }
493
379
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
494
380
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
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), {
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",
505
391
  children: [
506
- /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
507
- children: "Test submenu list of new datasets."
392
+ noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
393
+ variation: "error",
394
+ heading: "No results found."
508
395
  }),
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",
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: "",
536
416
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
537
- className: "ds-u-margin-y--0",
417
+ className: "ds-u-margin-y--0 ds-u-font-size--sm",
538
418
  "aria-hidden": "true",
539
- children: currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
419
+ children: data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
540
420
  children: [
541
421
  "Viewing ",
542
- currentResultNumbers.endingNumber,
422
+ submenuItemsCount,
543
423
  " of ",
544
424
  data.data.total
545
425
  ]
546
426
  })
547
427
  })
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
+ })
548
443
  })
549
- })
550
- ]
444
+ ]
445
+ })
551
446
  })
552
- })
447
+ ]
553
448
  })
554
449
  })
555
450
  });
556
451
  };
557
- var $9384a736d4d6f425$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($9384a736d4d6f425$var$DatasetListSubmenu);
452
+ var $10bc3aae21fc1572$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039)($10bc3aae21fc1572$var$DatasetListSubmenu);
558
453
 
559
454
 
560
455
 
561
456
 
562
457
 
563
- const $4f153ca537d853e5$var$SubMenuStaticItem = (submenuArray, subLinkClasses)=>// @todo: Move into a separate component
564
- submenuArray.map((s)=>{
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)=>{
565
463
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
566
464
  children: s.external || s.drupalPage ? /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
567
465
  href: s.url,
@@ -575,7 +473,7 @@ const $4f153ca537d853e5$var$SubMenuStaticItem = (submenuArray, subLinkClasses)=>
575
473
  }) : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$NavLink), {
576
474
  to: s.url,
577
475
  className: `ds-u-display-flex ds-u-align-items--center ${subLinkClasses}`,
578
- onClick: ()=>setIsExpanded(!isExpanded),
476
+ onClick: ()=>setIsExpanded((prev)=>!prev),
579
477
  children: [
580
478
  s.icon ?? null,
581
479
  /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
@@ -585,19 +483,16 @@ const $4f153ca537d853e5$var$SubMenuStaticItem = (submenuArray, subLinkClasses)=>
585
483
  })
586
484
  }, s.id);
587
485
  });
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"
486
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
487
+ className: `dkan-c-site-menu--sub-menu`,
488
+ children: submenuItems
597
489
  });
598
490
  };
491
+ var $6d0cf21faac6a2dd$export$2e2bcd8739ae039 = $6d0cf21faac6a2dd$var$SubMenuStaticList;
492
+
493
+
599
494
  const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, subLinkClasses: subLinkClasses, wrapLabel: wrapLabel = true })=>{
600
- const [isExpanded1, setIsExpanded1] = (0, $hgUW1$useState)(false);
495
+ const [isExpanded, setIsExpanded] = (0, $hgUW1$useState)(false);
601
496
  const headerContext = (0, $hgUW1$react).useContext((0, $11500a65bd7d9cf1$export$2e2bcd8739ae039));
602
497
  const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
603
498
  children: link.label
@@ -607,10 +502,10 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
607
502
  let currentMenu = null;
608
503
  if (menu.current) currentMenu = menu.current;
609
504
  function handleClickOutside(event) {
610
- if (currentMenu && !currentMenu.contains(event.target)) setIsExpanded1(false);
505
+ if (currentMenu && !currentMenu.contains(event.target)) setIsExpanded(false);
611
506
  }
612
507
  function handleFocusOut(event) {
613
- if (currentMenu && !currentMenu.contains(event.relatedTarget)) setIsExpanded1(false);
508
+ if (currentMenu && !currentMenu.contains(event.relatedTarget)) setIsExpanded(false);
614
509
  }
615
510
  document.addEventListener("mousedown", handleClickOutside);
616
511
  currentMenu?.addEventListener("focusout", handleFocusOut);
@@ -619,15 +514,26 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
619
514
  if (currentMenu) currentMenu.removeEventListener("focusout", handleFocusOut);
620
515
  };
621
516
  }, [
622
- isExpanded1
517
+ isExpanded
623
518
  ]);
624
519
  let submenuBlock;
625
520
  if (link.submenu) {
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);
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
+ }
628
534
  }
629
535
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
630
- className: `dkan-c-nav-submenu has-submenu${isExpanded1 ? " open" : ""}`,
536
+ className: `dkan-c-nav-submenu has-submenu${isExpanded ? " open" : ""}`,
631
537
  ref: menu,
632
538
  children: [
633
539
  /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
@@ -635,23 +541,20 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link, linkClasses: linkClasses, s
635
541
  onDark: headerContext.onDark,
636
542
  className: `${linkClasses}`,
637
543
  "aria-haspopup": "true",
638
- "aria-expanded": isExpanded1,
544
+ "aria-expanded": isExpanded,
639
545
  onClick: (e)=>{
640
546
  e.preventDefault();
641
- setIsExpanded1(!isExpanded1);
547
+ setIsExpanded(!isExpanded);
642
548
  },
643
549
  children: [
644
550
  innerHtml,
645
551
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$ArrowIcon), {
646
552
  className: "ds-u-margin-left--1",
647
- direction: isExpanded1 ? "down" : "right"
553
+ direction: isExpanded ? "down" : "right"
648
554
  })
649
555
  ]
650
556
  }),
651
- /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
652
- className: "dkan-c-site-menu--sub-menu",
653
- children: submenuBlock
654
- })
557
+ submenuBlock
655
558
  ]
656
559
  });
657
560
  };
@@ -1207,6 +1110,7 @@ const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
1207
1110
  version: "1.1",
1208
1111
  xmlns: "http://www.w3.org/2000/svg",
1209
1112
  xmlnsXlink: "http://www.w3.org/1999/xlink",
1113
+ "aria-hidden": "true",
1210
1114
  children: [
1211
1115
  /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1212
1116
  children: "Overview Icon"
@@ -1249,6 +1153,7 @@ const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
1249
1153
  version: "1.1",
1250
1154
  xmlns: "http://www.w3.org/2000/svg",
1251
1155
  xmlnsXlink: "http://www.w3.org/1999/xlink",
1156
+ "aria-hidden": "true",
1252
1157
  children: [
1253
1158
  /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1254
1159
  children: "Data Table Icon"
@@ -1281,6 +1186,7 @@ const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
1281
1186
  version: "1.1",
1282
1187
  xmlns: "http://www.w3.org/2000/svg",
1283
1188
  xmlnsXlink: "http://www.w3.org/1999/xlink",
1189
+ "aria-hidden": "true",
1284
1190
  children: [
1285
1191
  /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1286
1192
  children: "API Icon"
@@ -1313,6 +1219,7 @@ const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
1313
1219
  version: "1.1",
1314
1220
  xmlns: "http://www.w3.org/2000/svg",
1315
1221
  xmlnsXlink: "http://www.w3.org/1999/xlink",
1222
+ "aria-hidden": "true",
1316
1223
  children: [
1317
1224
  /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1318
1225
  children: "Download Icon"
@@ -1342,6 +1249,7 @@ const $b38839fd67928f42$var$SearchItemIcon = (props)=>{
1342
1249
  version: "1.1",
1343
1250
  xmlns: "http://www.w3.org/2000/svg",
1344
1251
  xmlnsXlink: "http://www.w3.org/1999/xlink",
1252
+ "aria-hidden": "true",
1345
1253
  children: [
1346
1254
  /*#__PURE__*/ (0, $hgUW1$jsx)("title", {
1347
1255
  children: "Data Dictionary Icon"
@@ -1564,11 +1472,29 @@ const $20de4fedf33d4f9a$var$DatasetDate = (props)=>{
1564
1472
  var $20de4fedf33d4f9a$export$2e2bcd8739ae039 = $20de4fedf33d4f9a$var$DatasetDate;
1565
1473
 
1566
1474
 
1475
+ function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
1476
+ if (dist && dist.data) {
1477
+ if (dist.data.format) return dist.data.format.toLowerCase();
1478
+ if (dist.data.mediaType) {
1479
+ const mediaType = dist.data.mediaType.split("/");
1480
+ if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
1481
+ }
1482
+ if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
1483
+ if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
1484
+ const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
1485
+ if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
1486
+ }
1487
+ }
1488
+ }
1489
+ return "";
1490
+ }
1491
+
1492
+
1567
1493
  const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
1568
1494
  const desktop = (0, $hgUW1$useMediaQuery)({
1569
1495
  minWidth: 1024
1570
1496
  });
1571
- const { title: title, modified: modified, description: description, downloadUrl: downloadUrl, largeFile: largeFile = false, paginationEnabled: paginationEnabled, dataDictionaryLinks: dataDictionaryLinks, identifier: identifier, refresh: refresh, released: released, showDateDetails: showDateDetails = false, showTopics: showTopics = false, theme: theme, topicSlugs: topicSlugs } = props;
1497
+ const { title: title, modified: modified, description: description, downloadUrl: downloadUrl, largeFile: largeFile = false, paginationEnabled: paginationEnabled, dataDictionaryLinks: dataDictionaryLinks, identifier: identifier, refresh: refresh, released: released, showDateDetails: showDateDetails = false, showTopics: showTopics = false, theme: theme, topicSlugs: topicSlugs, distribution: distribution } = props;
1572
1498
  const location = (0, $hgUW1$useLocation)();
1573
1499
  let linkContainerClasses = "ds-u-margin-bottom--2";
1574
1500
  if (dataDictionaryLinks) linkContainerClasses += " ds-l-col--6 ds-u-padding-right--0";
@@ -1607,6 +1533,66 @@ const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
1607
1533
  refresh: refresh
1608
1534
  };
1609
1535
  const url = `/dataset/${identifier}`;
1536
+ const DataTableLink = ()=>{
1537
+ if ((0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv") return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Link), {
1538
+ to: `${url}#data-table`,
1539
+ children: [
1540
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
1541
+ id: "data-table"
1542
+ }),
1543
+ "Data Table"
1544
+ ]
1545
+ });
1546
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
1547
+ className: "dkan-disabled-link",
1548
+ component: "a",
1549
+ offset: [
1550
+ 0,
1551
+ 5
1552
+ ],
1553
+ title: "There is no Data Table associated with this dataset. Data Tables will only display for CSV files.",
1554
+ "aria-disabled": "true",
1555
+ children: [
1556
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
1557
+ id: "data-table"
1558
+ }),
1559
+ "Data Table"
1560
+ ]
1561
+ });
1562
+ };
1563
+ const dataDictionaryExists = ()=>{
1564
+ if (distribution && "data" in distribution) {
1565
+ if ("describedBy" in distribution.data && "describedByType" in distribution.data) return distribution.data.describedByType === "application/vnd.tableschema+json";
1566
+ }
1567
+ return false;
1568
+ };
1569
+ const DataDictionaryLink = ()=>{
1570
+ if (dataDictionaryExists()) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Link), {
1571
+ to: `${url}#data-dictionary`,
1572
+ children: [
1573
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
1574
+ id: "data-dictionary"
1575
+ }),
1576
+ "Data Dictionary"
1577
+ ]
1578
+ });
1579
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
1580
+ className: "dkan-disabled-link",
1581
+ component: "a",
1582
+ offset: [
1583
+ 0,
1584
+ 5
1585
+ ],
1586
+ title: "There is no Data Dictionary associated with this dataset.",
1587
+ "aria-disabled": "true",
1588
+ children: [
1589
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
1590
+ id: "data-dictionary"
1591
+ }),
1592
+ "Data Dictionary"
1593
+ ]
1594
+ });
1595
+ };
1610
1596
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1611
1597
  className: "dc-c-search-list-item ds-u-padding-top--3",
1612
1598
  children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
@@ -1688,16 +1674,8 @@ const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
1688
1674
  /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1689
1675
  className: linkContainerClasses,
1690
1676
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1691
- className: linkClasses,
1692
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Link), {
1693
- to: `${url}#data-table`,
1694
- children: [
1695
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
1696
- id: "data-table"
1697
- }),
1698
- "Data Table"
1699
- ]
1700
- })
1677
+ className: `${linkClasses}${(0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv" ? "" : " dkan-disabled-link-wrapper"}`,
1678
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)(DataTableLink, {})
1701
1679
  })
1702
1680
  }),
1703
1681
  /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
@@ -1718,16 +1696,8 @@ const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
1718
1696
  dataDictionaryLinks ? /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1719
1697
  className: linkContainerClasses,
1720
1698
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1721
- className: linkClasses,
1722
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Link), {
1723
- to: `${url}#data-dictionary`,
1724
- children: [
1725
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
1726
- id: "data-dictionary"
1727
- }),
1728
- "Data Dictionary"
1729
- ]
1730
- })
1699
+ className: `${linkClasses}${dataDictionaryExists() ? "" : " dkan-disabled-link-wrapper"}`,
1700
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)(DataDictionaryLink, {})
1731
1701
  })
1732
1702
  }) : "",
1733
1703
  /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
@@ -1762,6 +1732,7 @@ var $52c6454cae137465$export$2e2bcd8739ae039 = $52c6454cae137465$var$DatasetSear
1762
1732
 
1763
1733
 
1764
1734
 
1735
+
1765
1736
  const $789279954d8eff7f$var$ApiDocumentation = ({ endpoint: endpoint })=>{
1766
1737
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
1767
1738
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
@@ -2247,6 +2218,7 @@ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: heade
2247
2218
  style: {
2248
2219
  width: header.getSize()
2249
2220
  },
2221
+ title: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "",
2250
2222
  className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
2251
2223
  children: [
2252
2224
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
@@ -2254,7 +2226,6 @@ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: heade
2254
2226
  children: [
2255
2227
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2256
2228
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2257
- title: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "",
2258
2229
  children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
2259
2230
  })
2260
2231
  }),
@@ -2377,67 +2348,6 @@ var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTH
2377
2348
 
2378
2349
 
2379
2350
 
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
-
2441
2351
 
2442
2352
 
2443
2353
 
@@ -2507,6 +2417,10 @@ var $5fe94aeb50e0798b$export$2e2bcd8739ae039 = $5fe94aeb50e0798b$var$Card;
2507
2417
 
2508
2418
 
2509
2419
 
2420
+ const $ebda441784d176a5$var$ManageColumnsContext = /*#__PURE__*/ (0, $hgUW1$createContext)({});
2421
+ var $ebda441784d176a5$export$2e2bcd8739ae039 = $ebda441784d176a5$var$ManageColumnsContext;
2422
+
2423
+
2510
2424
 
2511
2425
  class $5d9e2ce238d53d29$var$ExcludeCheckboxKeyboardSensor extends (0, $hgUW1$KeyboardSensor) {
2512
2426
  // Custom function to exclude checkbox from keyboard dragging
@@ -2544,10 +2458,8 @@ class $5d9e2ce238d53d29$var$ExcludeCheckboxPointerSensor extends (0, $hgUW1$Poin
2544
2458
  }
2545
2459
  ];
2546
2460
  }
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);
2461
+ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, modalOpen: modalOpen, setModalOpen: setModalOpen })=>{
2462
+ const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $ebda441784d176a5$export$2e2bcd8739ae039));
2551
2463
  // maintain card state separately from table state - only sync states when the Save button is pressed
2552
2464
  const [cards, setCards] = (0, $hgUW1$useState)(columns.map((c)=>{
2553
2465
  return {
@@ -2604,164 +2516,137 @@ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, default
2604
2516
  };
2605
2517
  }));
2606
2518
  };
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
- },
2519
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2520
+ className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
2521
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
2522
+ heading: "Manage columns",
2523
+ isOpen: modalOpen,
2524
+ onExit: ()=>{
2525
+ setModalOpen(false);
2526
+ resetCards();
2527
+ },
2528
+ className: "dkan-manage-columns-dialog",
2529
+ actions: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2530
+ 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",
2617
2531
  children: [
2618
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2619
- className: "fa fa-columns ds-u-margin-right--1"
2620
- }),
2621
- /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2622
- children: [
2623
- /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2624
- className: "ds-u-display--none ds-u-lg-display--inline-block",
2625
- children: "Manage Columns"
2626
- }),
2627
- hiddenColumns ? ` (${hiddenColumns})` : ""
2628
- ]
2629
- })
2630
- ]
2631
- }),
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();
2640
- },
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",
2532
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2533
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0",
2644
2534
  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
- ]
2535
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2536
+ variation: "solid",
2537
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2538
+ onClick: ()=>{
2539
+ setModalOpen(false);
2540
+ // update table state
2541
+ // Visibility
2542
+ // This code is building a new columnVisibility state object from the card state and doing a single setState on the table
2543
+ // vs doing a setState on every changed column individually
2544
+ const newColumnVisibility = Object.fromEntries(cards.map((c)=>Object.values(c)));
2545
+ setColumnVisibility(newColumnVisibility);
2546
+ // Card order
2547
+ const newCardOrder = cards.map((c)=>{
2548
+ return c.id;
2549
+ });
2550
+ setColumnOrder(newCardOrder);
2551
+ // save to localStorage
2552
+ const localStorageData = {
2553
+ tableColumnOrder: newCardOrder,
2554
+ tableColumnVisibility: newColumnVisibility
2555
+ };
2556
+ localStorage.setItem(id, JSON.stringify(localStorageData));
2557
+ },
2558
+ children: "Save"
2683
2559
  }),
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
- })
2560
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2561
+ variation: "ghost",
2562
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2563
+ onClick: ()=>{
2564
+ setModalOpen(false);
2565
+ resetCards();
2566
+ },
2567
+ children: "Cancel"
2702
2568
  })
2703
2569
  ]
2704
2570
  }),
2705
- children: [
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."
2710
- }),
2711
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
2712
- checked: cardHiddenColumns === 0,
2713
- type: "checkbox",
2714
- onChange: ()=>{
2715
- setCards(cards.map((c)=>{
2571
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2572
+ 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",
2573
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2574
+ variation: "ghost",
2575
+ className: "ds-l-col--6 ds-l-sm-col--auto",
2576
+ onClick: ()=>{
2577
+ // reset to default column order and set all cards to visible
2578
+ // do not save this to the table state until the "Save" button is clicked
2579
+ setCards(defaultColumnOrder.map((column)=>{
2580
+ const card = cards.filter((c)=>c.id === column)[0];
2716
2581
  return {
2717
- ...c,
2718
- visible: cardHiddenColumns !== 0
2582
+ ...card,
2583
+ visible: true
2719
2584
  };
2720
2585
  }));
2721
2586
  },
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
- ]
2587
+ children: "Reset Columns"
2588
+ })
2589
+ })
2590
+ ]
2591
+ }),
2592
+ children: [
2593
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2594
+ id: "reorder-help",
2595
+ className: "ds-u-padding-x--3",
2596
+ 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."
2597
+ }),
2598
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
2599
+ checked: cardHiddenColumns === 0,
2600
+ type: "checkbox",
2601
+ onChange: ()=>{
2602
+ setCards(cards.map((c)=>{
2603
+ return {
2604
+ ...c,
2605
+ visible: cardHiddenColumns !== 0
2606
+ };
2607
+ }));
2608
+ },
2609
+ className: "ds-u-padding-x--3",
2610
+ name: "",
2611
+ value: "",
2612
+ label: "Select all",
2613
+ hint: cardHiddenColumns && cardHiddenColumns + " columns hidden"
2614
+ }),
2615
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2616
+ 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",
2617
+ children: [
2618
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2619
+ children: "Display column"
2738
2620
  }),
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
- })
2759
- })
2621
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2622
+ children: "Reorder"
2760
2623
  })
2761
2624
  ]
2625
+ }),
2626
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$DndContext), {
2627
+ collisionDetection: (0, $hgUW1$closestCenter),
2628
+ modifiers: [
2629
+ (0, $hgUW1$restrictToVerticalAxis)
2630
+ ],
2631
+ sensors: sensors,
2632
+ onDragEnd: handleDragEnd,
2633
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$SortableContext), {
2634
+ items: cardOrder,
2635
+ strategy: (0, $hgUW1$verticalListSortingStrategy),
2636
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
2637
+ className: "dkan-manage-columns-list",
2638
+ children: cards.map((card)=>{
2639
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5fe94aeb50e0798b$export$2e2bcd8739ae039), {
2640
+ id: card.id,
2641
+ visible: card.visible,
2642
+ updateVisibility: updateVisibility
2643
+ }, card.id);
2644
+ })
2645
+ })
2646
+ })
2762
2647
  })
2763
- })
2764
- ]
2648
+ ]
2649
+ })
2765
2650
  });
2766
2651
  };
2767
2652
  var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColumns;
@@ -2780,116 +2665,139 @@ var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColum
2780
2665
 
2781
2666
 
2782
2667
 
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;
2846
2668
 
2847
2669
 
2848
- const $16bd41951b91f02d$var$FullScreenDataTable = ({ isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
2849
- const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
2850
- if (isModal) return null;
2670
+ const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL: downloadURL, unfilteredDownloadURL: unfilteredDownloadURL, setPage: setPage, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
2671
+ const { limit: limit, offset: offset, count: count, conditions: conditions, setLimit: setLimit, setOffset: setOffset } = resource;
2672
+ const intCount = count ? count : 0;
2673
+ const rowOptions = [
2674
+ 10,
2675
+ 25,
2676
+ 50,
2677
+ 100
2678
+ ];
2851
2679
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2852
- className: "dkan-fullscreen-data-table-wrapper",
2680
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between",
2853
2681
  children: [
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
- },
2682
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2683
+ 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",
2861
2684
  children: [
2862
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2863
- className: `fa ${isModal ? "fa-compress" : "fa-expand"} ds-u-margin-right--1`
2685
+ showCopyLinkButton && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2686
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-bottom--2",
2687
+ children: conditions && conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
2688
+ onOpen: ()=>{
2689
+ navigator.clipboard.writeText(window.location.href);
2690
+ },
2691
+ className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2692
+ placement: "bottom",
2693
+ dialog: true,
2694
+ ariaLabel: "Copy link to filtered data",
2695
+ title: "Link copied to clipboard",
2696
+ "aria-disabled": !conditions || conditions.length === 0,
2697
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2698
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2699
+ children: [
2700
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2701
+ className: "fas fa-copy"
2702
+ }),
2703
+ " Copy link to filtered data"
2704
+ ]
2705
+ })
2706
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2707
+ "aria-disabled": true,
2708
+ "aria-label": "Copy link to filtered data",
2709
+ className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2710
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2711
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2712
+ children: [
2713
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2714
+ className: "fas fa-copy"
2715
+ }),
2716
+ " Copy link to filtered data"
2717
+ ]
2718
+ })
2719
+ })
2864
2720
  }),
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"
2721
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2722
+ 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",
2723
+ children: [
2724
+ (showDownloadFilteredDataButton || showStoredQueryDownloadButton) && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2725
+ 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",
2726
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2727
+ 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",
2728
+ href: downloadURL,
2729
+ "aria-disabled": !conditions || conditions.length === 0,
2730
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2731
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2732
+ children: [
2733
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2734
+ className: "fas fa-file-csv"
2735
+ }),
2736
+ " ",
2737
+ showDownloadFilteredDataButton ? `Download filtered data (CSV)` : `Download stored query data (CSV)`
2738
+ ]
2739
+ })
2740
+ })
2741
+ }),
2742
+ showDownloadFullDataButton && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2743
+ 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",
2744
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2745
+ 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",
2746
+ href: unfilteredDownloadURL,
2747
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2748
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2749
+ children: [
2750
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2751
+ className: "fas fa-file-csv"
2752
+ }),
2753
+ " Download full dataset (CSV)"
2754
+ ]
2755
+ })
2756
+ })
2757
+ })
2758
+ ]
2868
2759
  })
2869
2760
  ]
2870
2761
  }),
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)
2762
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2763
+ 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",
2764
+ children: [
2765
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2766
+ className: "ds-l-col--12 ds-l-sm-col--8 ds-u-padding-x--0",
2767
+ children: !resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
2768
+ totalRows: intCount,
2769
+ limit: limit,
2770
+ offset: offset
2771
+ })
2772
+ }),
2773
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2774
+ className: "ds-l-col--12 ds-l-sm-col--4 ds-u-display--flex ds-u-justify-content--end ds-u-padding-x--0",
2775
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2776
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2777
+ options: rowOptions.map((row)=>({
2778
+ label: row.toString(),
2779
+ value: row
2780
+ })),
2781
+ size: "medium",
2782
+ label: "Rows per page:",
2783
+ labelClassName: "ds-u-margin-top--0",
2784
+ name: "datatable_rows_per_page",
2785
+ onChange: (e)=>{
2786
+ setLimit(parseInt(e.target.value));
2787
+ setPage(1);
2788
+ setOffset(0);
2789
+ },
2790
+ value: limit.toString(),
2791
+ defaultValue: limit.toString()
2792
+ })
2793
+ })
2881
2794
  })
2882
- })
2795
+ ]
2883
2796
  })
2884
2797
  ]
2885
2798
  });
2886
2799
  };
2887
- var $16bd41951b91f02d$export$2e2bcd8739ae039 = $16bd41951b91f02d$var$FullScreenDataTable;
2888
-
2889
-
2890
-
2891
-
2892
-
2800
+ var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHeader;
2893
2801
 
2894
2802
 
2895
2803
 
@@ -2901,145 +2809,226 @@ var $16bd41951b91f02d$export$2e2bcd8739ae039 = $16bd41951b91f02d$var$FullScreenD
2901
2809
 
2902
2810
 
2903
2811
 
2904
-
2905
-
2906
- function $eadd6431fddf4b6c$var$getStartDate(condition, schema, id) {
2907
- if (schema[id].fields[condition.property].mysql_type === "date") {
2908
- const newDate = new Date(condition.value.toString());
2909
- if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
2910
- }
2911
- return new Date();
2912
- }
2913
- const $eadd6431fddf4b6c$var$FilterItem = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema, className: className = "" })=>{
2914
- const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
2915
- const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
2916
- const [value, setValue] = (0, $hgUW1$useState)(condition.value);
2917
- const [startDate, setStartDate] = (0, $hgUW1$react).useState($eadd6431fddf4b6c$var$getStartDate(condition, schema, id));
2918
- const xl = (0, $hgUW1$useMediaQuery)({
2919
- minWidth: 1280
2812
+ const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
2813
+ const { fields: fields } = schema;
2814
+ const prependedMessage = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
2815
+ children: "Data filters: "
2920
2816
  });
2921
- (0, $hgUW1$useEffect)(()=>{
2922
- if (property !== condition.property) {
2923
- if (property) update(index, "property", property);
2924
- else update(index, "property", "");
2925
- if (schema[id].fields[condition.property].mysql_type === "date") {
2926
- if (!value) setValue(startDate.toJSON().slice(0, 10));
2927
- }
2928
- }
2929
- }, [
2930
- property,
2931
- value,
2932
- startDate,
2933
- schema,
2934
- id,
2935
- condition
2936
- ]);
2937
- (0, $hgUW1$useEffect)(()=>{
2938
- if (operator !== condition.operator) {
2939
- if (operator) update(index, "operator", operator);
2940
- else update(index, "operator", "");
2941
- }
2942
- }, [
2943
- operator
2944
- ]);
2945
- (0, $hgUW1$useEffect)(()=>{
2946
- if (value !== condition.value) {
2947
- if (value) update(index, "value", value);
2948
- else update(index, "value", "");
2949
- }
2950
- }, [
2951
- value
2817
+ if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2818
+ className: "ds-u-margin-y--0",
2819
+ children: [
2820
+ prependedMessage,
2821
+ " none"
2822
+ ]
2823
+ });
2824
+ function formatValue(text, property) {
2825
+ if (customColumns && customColumns.length > 0) {
2826
+ let newValue = text;
2827
+ let customColumn = customColumns.find((c)=>c.accessor === property);
2828
+ if (customColumn && customColumn.cell) return customColumn.cell({
2829
+ value: text
2830
+ });
2831
+ return text;
2832
+ } else return text;
2833
+ }
2834
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2835
+ className: "dc-querybuilder-title",
2836
+ children: [
2837
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2838
+ className: "ds-u-margin-y--0",
2839
+ children: prependedMessage
2840
+ }),
2841
+ conditions.map((c)=>{
2842
+ const field = fields[c.property];
2843
+ const description = field && field.description ? field.description : c.property;
2844
+ const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
2845
+ const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
2846
+ const formattedText = formatValue(cleanedText, c.property);
2847
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2848
+ className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
2849
+ children: [
2850
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2851
+ className: "ds-u-font-weight--bold",
2852
+ children: description
2853
+ }),
2854
+ " ",
2855
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2856
+ className: "ds-u-font-weight--normal",
2857
+ children: operator.label.toUpperCase()
2858
+ }),
2859
+ " ",
2860
+ /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2861
+ className: "ds-u-color--success",
2862
+ children: formattedText
2863
+ })
2864
+ ]
2865
+ });
2866
+ }).reduce((prev, curr)=>[
2867
+ prev,
2868
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
2869
+ className: "ds-u-margin-x--1",
2870
+ variation: "info",
2871
+ children: "AND"
2872
+ }),
2873
+ curr
2874
+ ])
2875
+ ]
2876
+ });
2877
+ };
2878
+ var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
2879
+
2880
+
2881
+
2882
+
2883
+
2884
+
2885
+
2886
+
2887
+
2888
+ function $6369abf590ca298f$var$getStartDate(condition, schema, id) {
2889
+ if (schema[id].fields[condition.property].mysql_type === "date") {
2890
+ const newDate = new Date(condition.value.toString());
2891
+ if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
2892
+ }
2893
+ return new Date();
2894
+ }
2895
+ const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema })=>{
2896
+ const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
2897
+ const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
2898
+ const [value, setValue] = (0, $hgUW1$useState)(condition.value);
2899
+ const [startDate, setStartDate] = (0, $hgUW1$react).useState($6369abf590ca298f$var$getStartDate(condition, schema, id));
2900
+ const xl = (0, $hgUW1$useMediaQuery)({
2901
+ minWidth: 1280
2902
+ });
2903
+ (0, $hgUW1$useEffect)(()=>{
2904
+ if (property !== condition.property) {
2905
+ if (property) update(index, "property", property);
2906
+ else update(index, "property", "");
2907
+ if (schema[id].fields[condition.property].mysql_type === "date") {
2908
+ if (!value) setValue(startDate.toJSON().slice(0, 10));
2909
+ }
2910
+ }
2911
+ }, [
2912
+ property,
2913
+ value,
2914
+ startDate,
2915
+ schema,
2916
+ id,
2917
+ condition
2918
+ ]);
2919
+ (0, $hgUW1$useEffect)(()=>{
2920
+ if (operator !== condition.operator) {
2921
+ if (operator) update(index, "operator", operator);
2922
+ else update(index, "operator", "");
2923
+ }
2924
+ }, [
2925
+ operator
2926
+ ]);
2927
+ (0, $hgUW1$useEffect)(()=>{
2928
+ if (value !== condition.value) {
2929
+ if (value) update(index, "value", value);
2930
+ else update(index, "value", "");
2931
+ }
2932
+ }, [
2933
+ value
2952
2934
  ]);
2953
2935
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
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}` : ""}`,
2936
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between ds-u-align-items--center ds-u-border--0",
2955
2937
  children: [
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)
2963
- }),
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)
2938
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2939
+ className: "ds-l-col--12 ds-l-md-col--8 ds-u-display--flex ds-u-justify-content--between ds-u-padding-x--0",
2940
+ children: [
2941
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2942
+ options: propertyOptions,
2943
+ className: "ds-l-col--8 ds-u-padding-left--0",
2944
+ value: property,
2945
+ label: "Column Name",
2946
+ name: `${condition.key}_property`,
2947
+ onChange: (e)=>setProperty(e.target.value)
2948
+ }),
2949
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
2950
+ options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
2951
+ className: "ds-l-col--4 ds-u-padding-x--0",
2952
+ value: operator,
2953
+ label: "Operator",
2954
+ name: `${condition.key}_operator`,
2955
+ onChange: (e)=>setOperator(e.target.value)
2956
+ })
2957
+ ]
2971
2958
  }),
2972
- schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2959
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2960
+ 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",
2973
2961
  children: [
2974
- /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
2975
- className: "ds-c-label",
2976
- htmlFor: `${condition.key}_date_value`,
2977
- id: `${condition.key}_date_value-label`,
2962
+ schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2963
+ children: [
2964
+ /*#__PURE__*/ (0, $hgUW1$jsx)("label", {
2965
+ className: "ds-c-label",
2966
+ htmlFor: `${condition.key}_date_value`,
2967
+ id: `${condition.key}_date_value-label`,
2968
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2969
+ children: "Value"
2970
+ })
2971
+ }),
2972
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
2973
+ name: `${condition.key}_date_value`,
2974
+ selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
2975
+ onChange: (date)=>{
2976
+ setStartDate(date);
2977
+ setValue(date.toJSON().slice(0, 10));
2978
+ },
2979
+ showMonthDropdown: true,
2980
+ showYearDropdown: true,
2981
+ dropdownMode: "select",
2982
+ className: "ds-c-field",
2983
+ withPortal: true
2984
+ })
2985
+ ]
2986
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
2987
+ className: "ds-l-col--11 ds-u-padding-x--0",
2988
+ label: "Value",
2989
+ name: `${condition.key}_value`,
2990
+ value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
2991
+ onChange: (e)=>setValue(e.target.value)
2992
+ }),
2993
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2994
+ variation: "ghost",
2995
+ size: "small",
2996
+ className: "ds-u-margin-top--6 ds-u-padding-right--0",
2997
+ "aria-label": "Delete filter",
2998
+ onClick: ()=>remove(index),
2978
2999
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
2979
- children: "Value"
3000
+ className: "fas fa-trash"
2980
3001
  })
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
2994
3002
  })
2995
3003
  ]
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
- })
3013
3004
  })
3014
3005
  ]
3015
3006
  });
3016
3007
  };
3017
- var $eadd6431fddf4b6c$export$2e2bcd8739ae039 = $eadd6431fddf4b6c$var$FilterItem;
3008
+ var $6369abf590ca298f$export$2e2bcd8739ae039 = $6369abf590ca298f$var$QueryRow;
3018
3009
 
3019
3010
 
3020
3011
 
3021
3012
 
3022
3013
 
3023
3014
 
3024
-
3025
- const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn, disableDefaultClasses: disableDefaultClasses = false, className: className = "" })=>{
3015
+ const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn })=>{
3026
3016
  const small = (0, $hgUW1$useMediaQuery)({
3027
3017
  minWidth: 0,
3028
3018
  maxWidth: 544
3029
3019
  });
3030
3020
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3031
3021
  disabled: disabled,
3032
- className: `dkan-clear-dataset-filters-button ${disableDefaultClasses ? "" : " ds-u-float--right ds-l-md-col--6 ds-l-col--5"}${className !== "" ? ` ${className}` : ""}`,
3022
+ className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5",
3033
3023
  variation: small ? "ghost" : undefined,
3034
3024
  onClick: ()=>clearFiltersFn(),
3035
- children: "Reset"
3025
+ children: small ? "Clear all" : "Clear all filters"
3036
3026
  });
3037
3027
  };
3038
3028
  var $2eec38d4d0dbf714$export$2e2bcd8739ae039 = $2eec38d4d0dbf714$var$ClearFiltersButton;
3039
3029
 
3040
3030
 
3041
-
3042
- function $6f4318b1e14124e5$var$updateQueryForDatastore(condition) {
3031
+ function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
3043
3032
  let cond = condition;
3044
3033
  delete cond.key;
3045
3034
  if (cond.operator === "=" || cond.operator === "<>") {
@@ -3057,19 +3046,12 @@ function $6f4318b1e14124e5$var$updateQueryForDatastore(condition) {
3057
3046
  if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
3058
3047
  return cond;
3059
3048
  }
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;
3049
+ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, customColumns: customColumns, isModal: isModal = false, setPage: setPage, setOffset: setOffset })=>{
3050
+ const { conditions: conditions, schema: schema, setConditions: setConditions } = resource;
3068
3051
  const fields = Object.keys(schema[id].fields);
3069
3052
  const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
3070
- const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]);
3053
+ const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]); // Add use effect to load conditions on first load if needed
3071
3054
  const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);
3072
- const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
3073
3055
  const syncConditions = ()=>{
3074
3056
  if (conditions && conditions.length) {
3075
3057
  const keyedConditions = conditions.map((oc)=>({
@@ -3104,7 +3086,7 @@ const $6f4318b1e14124e5$var$FilterDataset = ()=>{
3104
3086
  ]);
3105
3087
  };
3106
3088
  // Sync the UI with the actual data conditions whenever those change
3107
- (0, $hgUW1$useEffect)(()=>{
3089
+ (0, $hgUW1$react).useEffect(()=>{
3108
3090
  syncConditions();
3109
3091
  setTitleConditions(conditions);
3110
3092
  }, [
@@ -3130,37 +3112,21 @@ const $6f4318b1e14124e5$var$FilterDataset = ()=>{
3130
3112
  });
3131
3113
  window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
3132
3114
  };
3133
- const submitConditions = ()=>{
3115
+ const submitConditions = (e)=>{
3134
3116
  // only update the data conditions when "Apply filters" is pressed
3117
+ e.preventDefault();
3135
3118
  const submitConditions = queryConditions.filter((oc)=>{
3136
3119
  if (oc.property) return oc;
3137
3120
  return false;
3138
3121
  }).map((oc)=>{
3139
3122
  let cond = Object.assign({}, oc);
3140
- return $6f4318b1e14124e5$var$updateQueryForDatastore(cond);
3123
+ return $ee4ad47aa483e5b5$var$updateQueryForDatastore(cond);
3141
3124
  });
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;
3125
+ setConditions(submitConditions);
3126
+ setPage(1);
3127
+ setOffset(0);
3128
+ setConditionsChanged(false);
3129
+ updateBrowserURL(submitConditions);
3164
3130
  };
3165
3131
  const updateCondition = (index, key, value)=>{
3166
3132
  let newConditions = [
@@ -3176,451 +3142,258 @@ const $6f4318b1e14124e5$var$FilterDataset = ()=>{
3176
3142
  newConditions.splice(index, 1);
3177
3143
  setQueryConditions(newConditions);
3178
3144
  setConditionsChanged(true);
3179
- if (newConditions.length === 0) {
3180
- setConditions([]);
3181
- updateBrowserURL([]);
3182
- }
3183
- };
3184
- const disableFilterSubmitButton = ()=>{
3185
- return !conditionsChanged || queryConditions.length === 0 || conditionsReadyToSubmit(queryConditions).length === 0;
3186
3145
  };
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
- },
3146
+ return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3147
+ className: "dc-query-builder ds-u-margin-bottom--3",
3148
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3149
+ className: "ds-c-accordion ds-c-accordion--bordered",
3150
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
3151
+ heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
3152
+ schema: schema[id],
3153
+ conditions: titleConditions,
3154
+ customColumns: customColumns
3155
+ }),
3156
+ defaultOpen: !isModal,
3157
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("form", {
3158
+ onSubmit: (e)=>submitConditions(e),
3197
3159
  children: [
3198
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3199
- className: "fa fa-filter ds-u-margin-right--1"
3160
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3161
+ children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $6369abf590ca298f$export$2e2bcd8739ae039), {
3162
+ id: id,
3163
+ schema: schema,
3164
+ condition: qf,
3165
+ index: index,
3166
+ propertyOptions: propertyOptions,
3167
+ update: updateCondition,
3168
+ remove: removeCondition
3169
+ }, qf.key))
3200
3170
  }),
3201
- /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
3171
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3172
+ 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",
3202
3173
  children: [
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"}`
3174
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3175
+ 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",
3176
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3177
+ variation: "ghost",
3178
+ onClick: ()=>addCondition(null),
3179
+ className: "ds-u-padding-left--0",
3180
+ children: "+ Add filter"
3240
3181
  })
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."
3249
3182
  }),
3250
3183
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
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",
3184
+ className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
3252
3185
  children: [
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"
3256
- }),
3257
- /*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
3258
- className: "ds-u-margin--0 ds-u-font-weight--bold ds-u-padding--0",
3259
- children: "Condition"
3186
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3187
+ disabled: !conditionsChanged,
3188
+ className: "ds-u-float--right ds-l-md-col--6 ds-u-margin--right--0 ds-u-sm-margin-right--2",
3189
+ type: "submit",
3190
+ variation: "solid",
3191
+ children: "Apply filters"
3260
3192
  }),
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"
3193
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3194
+ disabled: queryConditions.length === 0,
3195
+ clearFiltersFn: ()=>{
3196
+ setConditions([]);
3197
+ updateBrowserURL([]);
3198
+ }
3267
3199
  })
3268
3200
  ]
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
- })
3298
3201
  })
3299
3202
  ]
3300
3203
  })
3301
- })
3204
+ ]
3302
3205
  })
3303
- ]
3304
- }) : null
3206
+ })
3207
+ })
3305
3208
  });
3306
3209
  };
3307
- var $6f4318b1e14124e5$export$2e2bcd8739ae039 = $6f4318b1e14124e5$var$FilterDataset;
3210
+ var $ee4ad47aa483e5b5$export$2e2bcd8739ae039 = $ee4ad47aa483e5b5$var$QueryBuilder;
3308
3211
 
3309
3212
 
3310
3213
 
3214
+ const $43a30d745a7bbc86$var$DataTableContext = /*#__PURE__*/ (0, $hgUW1$createContext)({
3215
+ id: null
3216
+ });
3217
+ var $43a30d745a7bbc86$export$2e2bcd8739ae039 = $43a30d745a7bbc86$var$DataTableContext;
3311
3218
 
3312
3219
 
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,
3220
+
3221
+ function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
3222
+ return columns.map((column)=>({
3223
+ header: schema && schema.fields[column].description ? schema.fields[column].description : column,
3224
+ accessor: column
3225
+ }));
3226
+ }
3227
+ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, closeFullScreenModal: closeFullScreenModal, showQueryBuilder: showQueryBuilder = true, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
3228
+ const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
3229
+ const { page: page, setPage: setPage } = (0, $hgUW1$useContext)((0, $ebda441784d176a5$export$2e2bcd8739ae039));
3230
+ const defaultPageSize = 10;
3231
+ const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
3232
+ const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
3233
+ const { limit: limit, setOffset: setOffset } = resource;
3234
+ const pageSize = limit ? limit : defaultPageSize;
3235
+ const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
3236
+ conditions: resource.conditions
3237
+ }, {
3238
+ encode: true
3239
+ })}&format=csv`;
3240
+ if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3317
3241
  children: [
3318
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3319
- className: `${iconClass} ds-u-color--primary ds-u-margin-right--1`
3242
+ showQueryBuilder && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee4ad47aa483e5b5$export$2e2bcd8739ae039), {
3243
+ resource: resource,
3244
+ id: distribution.identifier,
3245
+ customColumns: customColumnHeaders,
3246
+ isModal: isModal,
3247
+ setPage: setPage,
3248
+ setOffset: setOffset
3249
+ }),
3250
+ dataDictionaryBanner && !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3251
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3252
+ children: 'Click on the "Data Dictionary" tab above for full column definitions'
3253
+ })
3320
3254
  }),
3321
- text,
3322
- /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3323
- className: "fa fa-xmark ds-u-font-size--sm ds-u-margin-left--1"
3255
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6380a4a580b24362$export$2e2bcd8739ae039), {
3256
+ resource: resource,
3257
+ downloadURL: downloadURL,
3258
+ unfilteredDownloadURL: distribution.data.downloadURL,
3259
+ setPage: setPage,
3260
+ showCopyLinkButton: showCopyLinkButton,
3261
+ showDownloadFilteredDataButton: showDownloadFilteredDataButton,
3262
+ showDownloadFullDataButton: showDownloadFullDataButton,
3263
+ showStoredQueryDownloadButton: showStoredQueryDownloadButton
3264
+ }),
3265
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3266
+ className: `ds-u-border-x--1 ds-u-border-bottom--1 ${isModal && "dkan-datatable-fullscreen-mode"}`,
3267
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
3268
+ canResize: true,
3269
+ columns: columns,
3270
+ sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
3271
+ tablePadding: "ds-u-padding-y--2",
3272
+ loading: resource.loading,
3273
+ isModal: isModal,
3274
+ closeFullScreenModal: closeFullScreenModal
3275
+ })
3276
+ }),
3277
+ !resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3278
+ 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",
3279
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3280
+ totalPages: Math.ceil(resource.count ? resource.count / pageSize : 1),
3281
+ currentPage: Number(page),
3282
+ onPageChange: (evt, page)=>{
3283
+ evt.preventDefault();
3284
+ setOffset((page - 1) * limit);
3285
+ setPage(page);
3286
+ },
3287
+ renderHref: (p)=>`?page=${p}`,
3288
+ className: "ds-l-col--12 ds-u-padding-x--0"
3289
+ })
3324
3290
  })
3325
3291
  ]
3326
3292
  });
3293
+ else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
3294
+ "aria-valuetext": "Dataset loading",
3295
+ role: "status",
3296
+ className: "ds-u-margin--3"
3297
+ });
3327
3298
  };
3328
- var $c5b172e8d1a8197c$export$2e2bcd8739ae039 = $c5b172e8d1a8197c$var$FliterChip;
3329
-
3330
-
3331
-
3332
-
3333
-
3334
-
3299
+ var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
3335
3300
 
3336
3301
 
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;
3302
+ const $16bd41951b91f02d$var$FullScreenDataTable = ({ modalOpen: modalOpen, setModalOpen: setModalOpen })=>{
3348
3303
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
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
- ]
3304
+ className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
3305
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dialog), {
3306
+ heading: "Dataset Explorer",
3307
+ isOpen: modalOpen,
3308
+ onExit: ()=>setModalOpen(false),
3309
+ className: "dkan-full-screen-dataset-dialog",
3310
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
3311
+ isModal: true,
3312
+ closeFullScreenModal: ()=>setModalOpen(false)
3313
+ })
3491
3314
  })
3492
3315
  });
3493
3316
  };
3494
- var $dae856e97a09bcd6$export$2e2bcd8739ae039 = $dae856e97a09bcd6$var$DisplaySettings;
3495
-
3317
+ var $16bd41951b91f02d$export$2e2bcd8739ae039 = $16bd41951b91f02d$var$FullScreenDataTable;
3496
3318
 
3497
3319
 
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",
3320
+ const $71b4324f265dec16$var$DataTableControls = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
3321
+ const [manageColumnsModalOpen, setManageColumnsModalOpen] = (0, $hgUW1$useState)(false);
3322
+ const [fullScreenModalOpen, setFullScreenModalOpen] = (0, $hgUW1$useState)(false);
3323
+ const hiddenColumns = columns.filter((c)=>c.getIsVisible() === false).length;
3324
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3535
3325
  children: [
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",
3326
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3327
+ className: "ds-u-border-top--1 ds-u-fill--gray-lightest ds-u-display--flex ds-u-justify-content--between",
3328
+ children: [
3329
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3330
+ children: hiddenColumns > 0 && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Alert), {
3331
+ variation: "warn",
3552
3332
  children: [
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
- })
3333
+ hiddenColumns,
3334
+ " Columns Hidden"
3564
3335
  ]
3565
3336
  })
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"
3575
3337
  }),
3576
3338
  /*#__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",
3578
3339
  children: [
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",
3340
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
3341
+ "aria-label": "Manage columns - Opens in a dialog",
3342
+ className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
3343
+ onClick: ()=>{
3344
+ setManageColumnsModalOpen(true);
3345
+ },
3581
3346
  children: [
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
3347
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3348
+ className: "far fa-cog ds-u-margin-right--1"
3349
+ }),
3350
+ "Manage Columns"
3596
3351
  ]
3597
3352
  }),
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
- })
3353
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
3354
+ "aria-label": isModal ? "Close Full Screen dialog" : "Full Screen mode - Opens in a dialog",
3355
+ className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
3356
+ onClick: ()=>{
3357
+ if (isModal) closeFullScreenModal();
3358
+ else setFullScreenModalOpen(true);
3359
+ },
3360
+ children: [
3361
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
3362
+ className: `fa ${isModal ? "fa-compress" : "fa-expand"} ds-u-margin-right--1`
3363
+ }),
3364
+ isModal ? "Exit Full Screen" : "Full Screen"
3365
+ ]
3609
3366
  })
3610
3367
  ]
3611
3368
  })
3612
3369
  ]
3370
+ }),
3371
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3372
+ children: [
3373
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5d9e2ce238d53d29$export$2e2bcd8739ae039), {
3374
+ id: id,
3375
+ columns: columns,
3376
+ defaultColumnOrder: defaultColumnOrder,
3377
+ modalOpen: manageColumnsModalOpen,
3378
+ setModalOpen: setManageColumnsModalOpen
3379
+ }),
3380
+ !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $16bd41951b91f02d$export$2e2bcd8739ae039), {
3381
+ modalOpen: fullScreenModalOpen,
3382
+ setModalOpen: setFullScreenModalOpen
3383
+ })
3384
+ ]
3613
3385
  })
3614
3386
  ]
3615
3387
  });
3616
3388
  };
3617
- var $85f8ff1ff89899c7$export$2e2bcd8739ae039 = $85f8ff1ff89899c7$var$DataTableToolbar;
3389
+ var $71b4324f265dec16$export$2e2bcd8739ae039 = $71b4324f265dec16$var$DataTableControls;
3390
+
3618
3391
 
3619
3392
 
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;
3393
+
3394
+ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
3395
+ const { id: id, resource: resource, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
3396
+ const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $ebda441784d176a5$export$2e2bcd8739ae039));
3624
3397
  const data = resource.values;
3625
3398
  const [sorting, setSorting] = (0, $hgUW1$useState)([]);
3626
3399
  const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
@@ -3682,142 +3455,17 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sort
3682
3455
  ]);
3683
3456
  return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3684
3457
  children: [
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
- })
3458
+ datasetTableControls && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3459
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $71b4324f265dec16$export$2e2bcd8739ae039), {
3460
+ id: id,
3461
+ columns: table.getAllLeafColumns(),
3462
+ defaultColumnOrder: defaultColumnOrder,
3463
+ isModal: isModal,
3464
+ closeFullScreenModal: closeFullScreenModal
3699
3465
  })
3700
3466
  }),
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
- }),
3819
3467
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3820
- className: "dc-c-datatable-wrapper ds-u-border-x--1 ds-u-border-bottom--1",
3468
+ className: "dc-c-datatable-wrapper",
3821
3469
  tabIndex: 0,
3822
3470
  ref: dataTableWrapperElement,
3823
3471
  children: [
@@ -4379,6 +4027,61 @@ var $5723016a5461c1ca$export$2e2bcd8739ae039 = $5723016a5461c1ca$var$PageHeader;
4379
4027
 
4380
4028
 
4381
4029
 
4030
+ function $eff7d34c30f5a0fc$export$959638e8dca60ce6(facets) {
4031
+ let facetObj = {};
4032
+ if (facets) {
4033
+ facets.forEach((f)=>{
4034
+ if (facetObj[f.type]) facetObj[f.type] = [
4035
+ ...facetObj[f.type],
4036
+ f
4037
+ ];
4038
+ else facetObj[f.type] = [
4039
+ f
4040
+ ];
4041
+ });
4042
+ // sort facets descending by int value, put non int last
4043
+ if (facetObj.keyword) facetObj.keyword.sort((a, b)=>{
4044
+ if (Number(a.name) && Number(b.name)) return Number(b.name) - Number(a.name);
4045
+ });
4046
+ return facetObj;
4047
+ }
4048
+ }
4049
+ function $eff7d34c30f5a0fc$export$60ec7cc1d341a524(searchParams, defaultSortOptions) {
4050
+ const params = (0, $hgUW1$qs).parse(searchParams, {
4051
+ ignoreQueryPrefix: true
4052
+ });
4053
+ let themes = params.theme;
4054
+ let keywords = params.keyword;
4055
+ return {
4056
+ page: params.page,
4057
+ sort: !params.sort ? defaultSortOptions.defaultSort : params.sort,
4058
+ sortOrder: !params.sortOrder ? defaultSortOptions.defaultOrder : params.sortOrder,
4059
+ fulltext: params.fulltext,
4060
+ selectedFacets: {
4061
+ theme: themes ? themes : [],
4062
+ keyword: keywords ? keywords : []
4063
+ }
4064
+ };
4065
+ }
4066
+ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, ACA) {
4067
+ const { fulltext: fulltext, selectedFacets: selectedFacets, sort: sort, sortOrder: sortOrder, page: page, pageSize: pageSize } = options;
4068
+ let params = {
4069
+ fulltext: fulltext ? fulltext : undefined,
4070
+ ...selectedFacets,
4071
+ sort: sort ? sort : undefined,
4072
+ ["sort-order"]: sortOrder ? sortOrder : undefined,
4073
+ page: page !== 1 ? page : undefined,
4074
+ ["page-size"]: pageSize !== 10 ? pageSize : undefined
4075
+ };
4076
+ return await (0, $hgUW1$axios).get(`${rootUrl}/search/?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(params, ACA), {
4077
+ arrayFormat: "comma",
4078
+ encode: false
4079
+ })}`);
4080
+ }
4081
+
4082
+
4083
+
4084
+
4382
4085
 
4383
4086
  const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
4384
4087
  const { rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
@@ -4728,7 +4431,8 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
4728
4431
  downloadUrl: showDownloadIcon ? getDownloadUrl(item) : null,
4729
4432
  largeFile: showLargeFile,
4730
4433
  paginationEnabled: enablePagination,
4731
- dataDictionaryLinks: dataDictionaryLinks
4434
+ dataDictionaryLinks: dataDictionaryLinks,
4435
+ distribution: "%Ref:distribution" in item ? item["%Ref:distribution"][0] : {}
4732
4436
  }, item.identifier);
4733
4437
  }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
4734
4438
  variation: "error",
@@ -4779,11 +4483,10 @@ var $e873081a6e8f024e$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
4779
4483
 
4780
4484
 
4781
4485
 
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;
4486
+ const $550bcc185f420ff5$var$DatasetList = ({ rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
4487
+ defaultSort: "modified",
4488
+ defaultOrder: "desc"
4489
+ }, pageTitle: pageTitle = "What's New ", showLargeFileWarning: showLargeFileWarning = false, introText: introText = "", dataDictionaryLinks: dataDictionaryLinks = false })=>{
4787
4490
  const { ACA: ACA } = (0, $hgUW1$useContext)((0, $844981eac9b63865$export$eccc29c8d0ff408));
4788
4491
  const sortOptions = [
4789
4492
  {
@@ -4915,29 +4618,26 @@ const $550bcc185f420ff5$var$DatasetList = (props)=>{
4915
4618
  children: [
4916
4619
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4917
4620
  className: "ds-l-row",
4918
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4621
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4919
4622
  className: "ds-l-col--12",
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
- })
4623
+ children: showLargeFileWarning && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4624
+ className: "ds-l-row ds-u-margin-bottom--2 ds-u-margin-top--4",
4625
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4626
+ className: "ds-l-md-col--12",
4627
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
4628
+ bordered: true,
4629
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
4630
+ contentClassName: "downloading-datasets",
4631
+ heading: "Please read before downloading datasets",
4632
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3b2d31a9c6cd2284$export$2e2bcd8739ae039), {})
4933
4633
  })
4934
4634
  })
4935
4635
  })
4936
- ]
4636
+ })
4937
4637
  })
4938
4638
  }),
4939
4639
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4940
- className: "ds-l-row ds-u-padding-top--4",
4640
+ className: "ds-l-row",
4941
4641
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4942
4642
  className: "ds-l-col--12",
4943
4643
  children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
@@ -4949,32 +4649,40 @@ const $550bcc185f420ff5$var$DatasetList = (props)=>{
4949
4649
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4950
4650
  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",
4951
4651
  children: [
4952
- enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4652
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4953
4653
  className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--8 ds-u-sm-padding-left--0",
4954
4654
  children: [
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
- })
4655
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
4656
+ className: "ds-u-margin-bottom--3",
4657
+ children: introText ? introText : null
4970
4658
  }),
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
4659
+ enablePagination && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
4660
+ children: [
4661
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4662
+ className: "ds-u-margin-y--0",
4663
+ "aria-hidden": "true",
4664
+ children: currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
4665
+ children: [
4666
+ "Showing ",
4667
+ currentResultNumbers.startingNumber,
4668
+ " -",
4669
+ " ",
4670
+ currentResultNumbers.endingNumber,
4671
+ " of ",
4672
+ data.data.total,
4673
+ " datasets"
4674
+ ]
4675
+ })
4676
+ }),
4677
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4678
+ className: "ds-u-visibility--screen-reader",
4679
+ role: "status",
4680
+ "aria-live": "assertive",
4681
+ "aria-atomic": "true",
4682
+ "data-testid": "currentResults",
4683
+ children: announcementText
4684
+ })
4685
+ ]
4978
4686
  })
4979
4687
  ]
4980
4688
  }),
@@ -4993,7 +4701,7 @@ const $550bcc185f420ff5$var$DatasetList = (props)=>{
4993
4701
  }),
4994
4702
  /*#__PURE__*/ (0, $hgUW1$jsxs)("ol", {
4995
4703
  className: "dc-dataset-search-list ds-u-padding--0 ds-u-margin-top--0 ds-u-margin-bottom--4 ds-u-display--block",
4996
- "data-testid": "results-list",
4704
+ "data-testid": "datasetlist-results-list",
4997
4705
  children: [
4998
4706
  noResults && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
4999
4707
  variation: "error",
@@ -5055,7 +4763,6 @@ var $550bcc185f420ff5$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
5055
4763
 
5056
4764
 
5057
4765
 
5058
-
5059
4766
  const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl)=>{
5060
4767
  const [dataset, setDataset] = (0, $hgUW1$useState)({
5061
4768
  title: "",
@@ -5507,23 +5214,6 @@ const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
5507
5214
  var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
5508
5215
 
5509
5216
 
5510
- function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
5511
- if (dist && dist.data) {
5512
- if (dist.data.format) return dist.data.format.toLowerCase();
5513
- if (dist.data.mediaType) {
5514
- const mediaType = dist.data.mediaType.split("/");
5515
- if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
5516
- }
5517
- if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
5518
- if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
5519
- const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
5520
- if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
5521
- }
5522
- }
5523
- }
5524
- return "";
5525
- }
5526
-
5527
5217
 
5528
5218
 
5529
5219
  const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource: resource, title: title })=>{
@@ -6205,9 +5895,32 @@ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
6205
5895
 
6206
5896
 
6207
5897
 
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), {
5898
+
5899
+ const $39bc4d98030a5599$var$DataTableStateWrapper = ({ showQueryBuilder: showQueryBuilder = true, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
5900
+ const { id: id, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
5901
+ // a wrapper component to keep column state synced between full screen and regular modes
5902
+ const localStorageData = id ? JSON.parse(localStorage.getItem(id)) : null;
5903
+ const defaultPage = 1;
5904
+ const [page, setPage] = (0, $hgUW1$useState)(defaultPage);
5905
+ const [columnOrder, setColumnOrder] = (0, $hgUW1$useState)(()=>{
5906
+ if (datasetTableControls && localStorageData) return localStorageData.tableColumnOrder;
5907
+ else return [];
5908
+ });
5909
+ const [columnVisibility, setColumnVisibility] = (0, $hgUW1$useState)(()=>{
5910
+ if (datasetTableControls && localStorageData) return localStorageData.tableColumnVisibility;
5911
+ else return {};
5912
+ });
5913
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ebda441784d176a5$export$2e2bcd8739ae039).Provider, {
5914
+ value: {
5915
+ columnOrder: columnOrder,
5916
+ setColumnOrder: setColumnOrder,
5917
+ columnVisibility: columnVisibility,
5918
+ setColumnVisibility: setColumnVisibility,
5919
+ page: page,
5920
+ setPage: setPage
5921
+ },
6210
5922
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
5923
+ showQueryBuilder: showQueryBuilder,
6211
5924
  showCopyLinkButton: showCopyLinkButton,
6212
5925
  showDownloadFilteredDataButton: showDownloadFilteredDataButton,
6213
5926
  showDownloadFullDataButton: showDownloadFullDataButton,
@@ -6358,6 +6071,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6358
6071
  window.location.hash
6359
6072
  ]);
6360
6073
  const displayDataDictionaryTab = distribution.data && distribution.data.describedBy && distribution.data.describedByType === "application/vnd.tableschema+json" || datasetSitewideDictionary && datasetSitewideDictionary.length > 0;
6074
+ const formatType = (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution);
6361
6075
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
6362
6076
  children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
6363
6077
  content: notFoundContent,
@@ -6409,7 +6123,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6409
6123
  },
6410
6124
  selectedId: selectedTab,
6411
6125
  children: [
6412
- (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
6126
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
6413
6127
  id: "data-table",
6414
6128
  tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
6415
6129
  className: "ds-u-color--primary",
@@ -6421,7 +6135,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6421
6135
  ]
6422
6136
  }),
6423
6137
  className: borderlessTabs ? "ds-u-border--0 ds-u-padding-x--0" : "",
6424
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039).Provider, {
6138
+ children: (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039).Provider, {
6425
6139
  value: {
6426
6140
  id: id,
6427
6141
  resource: resource,
@@ -6432,6 +6146,8 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6432
6146
  datasetTableControls: !disableTableControls
6433
6147
  },
6434
6148
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {})
6149
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
6150
+ children: "There is no Data Table associated with this dataset. Data Tables will only display for CSV files."
6435
6151
  })
6436
6152
  }),
6437
6153
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
@@ -6453,7 +6169,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6453
6169
  metadataMapping: metadataMapping
6454
6170
  })
6455
6171
  }),
6456
- !hideDataDictionary && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TabPanel), {
6172
+ !hideDataDictionary && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
6457
6173
  id: "data-dictionary",
6458
6174
  tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
6459
6175
  className: "ds-u-color--primary",
@@ -6465,17 +6181,14 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6465
6181
  ]
6466
6182
  }),
6467
6183
  className: borderlessTabs ? "ds-u-border--0 ds-u-padding-x--0" : "",
6468
- children: [
6469
- displayDataDictionaryTab && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6012b86ffcaf3f71$export$2e2bcd8739ae039), {
6470
- datasetSitewideDictionary: datasetSitewideDictionary,
6471
- datasetDictionaryEndpoint: distribution.data.describedBy,
6472
- title: "Data Dictionary",
6473
- csvDownload: dataDictionaryCSV
6474
- }),
6475
- !displayDataDictionaryTab && /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
6476
- children: "There is no Data Dictionary associated with this dataset."
6477
- })
6478
- ]
6184
+ children: displayDataDictionaryTab ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6012b86ffcaf3f71$export$2e2bcd8739ae039), {
6185
+ datasetSitewideDictionary: datasetSitewideDictionary,
6186
+ datasetDictionaryEndpoint: distribution.data.describedBy,
6187
+ title: "Data Dictionary",
6188
+ csvDownload: dataDictionaryCSV
6189
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
6190
+ children: "There is no Data Dictionary associated with this dataset."
6191
+ })
6479
6192
  }),
6480
6193
  distribution && distribution.data && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
6481
6194
  id: "api",
@@ -7305,6 +7018,7 @@ function $8b67b7ee3fcfb629$export$2e2bcd8739ae039({ id: id, rootUrl: rootUrl, cu
7305
7018
  datasetTableControls: !disableTableControls
7306
7019
  },
7307
7020
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {
7021
+ showQueryBuilder: false,
7308
7022
  showCopyLinkButton: false,
7309
7023
  showDownloadFilteredDataButton: false,
7310
7024
  showDownloadFullDataButton: false,
@@ -7454,78 +7168,6 @@ var $374c4669b044ddf8$export$2e2bcd8739ae039 = $374c4669b044ddf8$var$QueryRow;
7454
7168
 
7455
7169
 
7456
7170
 
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
-
7529
7171
  function $3b6ca952e79f0695$var$updateQueryForDatastore(condition) {
7530
7172
  let cond = condition;
7531
7173
  delete cond.key;
@@ -8041,5 +7683,5 @@ var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollTo
8041
7683
 
8042
7684
 
8043
7685
 
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};
7686
+ 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};
8045
7687
  //# sourceMappingURL=main.js.map