@civicactions/cmsds-open-data-components 3.1.3-alpha.5 → 3.1.3-alpha.dd2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.css +19 -2
- package/dist/main.css.map +1 -1
- package/dist/main.js +472 -272
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {jsxs as $hgUW1$jsxs, jsx as $hgUW1$jsx, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
|
|
3
3
|
import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect} from "react";
|
|
4
|
-
import {Button as $hgUW1$Button, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dialog as $hgUW1$Dialog, AddIcon as $hgUW1$AddIcon, RemoveIcon as $hgUW1$RemoveIcon, Choice as $hgUW1$Choice, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Tooltip as $hgUW1$Tooltip, Badge as $hgUW1$Badge, Table as $hgUW1$Table, TableBody as $hgUW1$TableBody, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableHead as $hgUW1$TableHead} from "@cmsgov/design-system";
|
|
4
|
+
import {Button as $hgUW1$Button, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dialog as $hgUW1$Dialog, AddIcon as $hgUW1$AddIcon, RemoveIcon as $hgUW1$RemoveIcon, Choice as $hgUW1$Choice, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Tooltip as $hgUW1$Tooltip, Badge as $hgUW1$Badge, Table as $hgUW1$Table, TableBody as $hgUW1$TableBody, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableHead as $hgUW1$TableHead, TooltipIcon as $hgUW1$TooltipIcon} from "@cmsgov/design-system";
|
|
5
5
|
import $hgUW1$proptypes from "prop-types";
|
|
6
6
|
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";
|
|
7
7
|
import $hgUW1$qs from "qs";
|
|
@@ -1010,7 +1010,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1010
1010
|
["page-size"]: pageSize !== 10 ? pageSize : undefined,
|
|
1011
1011
|
...additionalParams
|
|
1012
1012
|
};
|
|
1013
|
-
const { data: data,
|
|
1013
|
+
const { data: data, isLoading: isLoading, error: error } = (0, $hgUW1$useQuery)({
|
|
1014
1014
|
queryKey: [
|
|
1015
1015
|
"datasets",
|
|
1016
1016
|
params
|
|
@@ -1110,7 +1110,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1110
1110
|
}),
|
|
1111
1111
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1112
1112
|
className: "ds-l-col--12 ds-l-sm-col--8",
|
|
1113
|
-
children:
|
|
1113
|
+
children: isLoading ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
1114
1114
|
className: "ds-u-valign--middle",
|
|
1115
1115
|
"aria-valuetext": "Dataset Search loading",
|
|
1116
1116
|
role: "status"
|
|
@@ -1271,24 +1271,24 @@ const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl, additi
|
|
|
1271
1271
|
const [id, setId] = (0, $hgUW1$useState)(datasetId);
|
|
1272
1272
|
const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
|
|
1273
1273
|
const additionalParamsString = Object.keys(additionalParams).length ? `&${(0, $hgUW1$qs).stringify(additionalParams)}` : "";
|
|
1274
|
-
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
1275
|
-
queryKey: [
|
|
1276
|
-
"metastore" + id + additionalParamsString
|
|
1277
|
-
],
|
|
1278
|
-
queryFn: ()=>{
|
|
1279
|
-
return fetch(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>res.json()).then((res)=>{
|
|
1280
|
-
return res;
|
|
1281
|
-
});
|
|
1282
|
-
}
|
|
1283
|
-
});
|
|
1284
1274
|
(0, $hgUW1$useEffect)(()=>{
|
|
1285
|
-
|
|
1275
|
+
async function fetchData() {
|
|
1276
|
+
return (0, $hgUW1$axios).get(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>setDataset(res.data)).catch((error)=>setDataset({
|
|
1277
|
+
title: dataset.title,
|
|
1278
|
+
distribution: dataset.distribution,
|
|
1279
|
+
error: error,
|
|
1280
|
+
description: dataset.description,
|
|
1281
|
+
identifier: dataset.identifier,
|
|
1282
|
+
modified: dataset.modified
|
|
1283
|
+
}));
|
|
1284
|
+
}
|
|
1285
|
+
fetchData();
|
|
1286
1286
|
}, [
|
|
1287
|
-
|
|
1287
|
+
id,
|
|
1288
|
+
rootUrl
|
|
1288
1289
|
]);
|
|
1289
1290
|
return {
|
|
1290
1291
|
dataset: dataset,
|
|
1291
|
-
isPending: isPending,
|
|
1292
1292
|
setId: setId,
|
|
1293
1293
|
setRootUrl: setRootUrl
|
|
1294
1294
|
};
|
|
@@ -1301,9 +1301,47 @@ var $b4aa9c66f2e86959$export$2e2bcd8739ae039 = $b4aa9c66f2e86959$var$useMetastor
|
|
|
1301
1301
|
|
|
1302
1302
|
|
|
1303
1303
|
|
|
1304
|
+
async function $0e7628cf73c71646$export$55f990b5477765d6(id, rootUrl, options, additionalParams) {
|
|
1305
|
+
const { keys: keys, limit: limit, offset: offset, conditions: conditions, sort: sort, groupings: groupings, prepareColumns: prepareColumns, properties: properties, setValues: setValues, setCount: setCount, setColumns: setColumns, setLoading: setLoading, setSchema: setSchema } = options;
|
|
1306
|
+
if (!id) // TODO: Throw error
|
|
1307
|
+
return false;
|
|
1308
|
+
if (typeof setLoading === "function") setLoading(true);
|
|
1309
|
+
return await (0, $hgUW1$axios)({
|
|
1310
|
+
method: "GET",
|
|
1311
|
+
url: `${rootUrl}/datastore/query/${id}`,
|
|
1312
|
+
params: {
|
|
1313
|
+
keys: keys,
|
|
1314
|
+
limit: limit,
|
|
1315
|
+
offset: offset,
|
|
1316
|
+
conditions: conditions,
|
|
1317
|
+
sorts: sort,
|
|
1318
|
+
properties: properties,
|
|
1319
|
+
groupings: groupings,
|
|
1320
|
+
...additionalParams
|
|
1321
|
+
},
|
|
1322
|
+
//paramsSerializer: {
|
|
1323
|
+
// serialize: qs.stringify
|
|
1324
|
+
//},
|
|
1325
|
+
paramsSerializer: (params)=>{
|
|
1326
|
+
return (0, $hgUW1$qs).stringify(params);
|
|
1327
|
+
}
|
|
1328
|
+
}).then((res)=>{
|
|
1329
|
+
const { data: data } = res;
|
|
1330
|
+
const propertyKeys = data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
|
|
1331
|
+
setValues(data.results), setCount(data.count);
|
|
1332
|
+
if (propertyKeys.length) setColumns(prepareColumns ? prepareColumns(propertyKeys) : propertyKeys);
|
|
1333
|
+
setSchema(data.schema);
|
|
1334
|
+
if (typeof setLoading === "function") setLoading(false);
|
|
1335
|
+
return data;
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
|
|
1304
1340
|
const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, additionalParams = {})=>{
|
|
1305
1341
|
const keys = options.keys ? options.keys : true;
|
|
1306
1342
|
const { prepareColumns: prepareColumns } = options;
|
|
1343
|
+
const [manual, setManual] = (0, $hgUW1$useState)(options.manual ? options.manual : false);
|
|
1344
|
+
const [requireConditions, setRequireConditions] = (0, $hgUW1$useState)(options.requireConditions ? options.requireConditions : false);
|
|
1307
1345
|
const [values, setValues] = (0, $hgUW1$useState)([]);
|
|
1308
1346
|
const [id, setResource] = (0, $hgUW1$useState)(resourceId);
|
|
1309
1347
|
const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
|
|
@@ -1311,43 +1349,63 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
1311
1349
|
const [count, setCount] = (0, $hgUW1$useState)(null);
|
|
1312
1350
|
const [columns, setColumns] = (0, $hgUW1$useState)([]);
|
|
1313
1351
|
const [offset, setOffset] = (0, $hgUW1$useState)(options.offset ? options.offset : 0);
|
|
1352
|
+
const [loading, setLoading] = (0, $hgUW1$useState)(false);
|
|
1314
1353
|
const [conditions, setConditions] = (0, $hgUW1$useState)(options.conditions ? options.conditions : undefined);
|
|
1315
1354
|
const [sort, setSort] = (0, $hgUW1$useState)(options.sort ? options.sort : undefined);
|
|
1316
1355
|
const [groupings, setGroupings] = (0, $hgUW1$useState)(options.groupings ? options.groupings : undefined);
|
|
1317
1356
|
const [schema, setSchema] = (0, $hgUW1$useState)({});
|
|
1318
1357
|
// const [joins, setJoins] = useState()
|
|
1319
1358
|
const [properties, setProperties] = (0, $hgUW1$useState)(options.properties ? options.properties : undefined);
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
sorts: sort,
|
|
1326
|
-
properties: properties,
|
|
1327
|
-
groupings: groupings,
|
|
1328
|
-
...additionalParams
|
|
1329
|
-
};
|
|
1330
|
-
const additionalParamsString = Object.keys(params).length ? `&${(0, $hgUW1$qs).stringify(params)}` : "";
|
|
1331
|
-
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
1332
|
-
queryKey: [
|
|
1333
|
-
"datastore" + id + additionalParamsString
|
|
1334
|
-
],
|
|
1335
|
-
queryFn: ()=>{
|
|
1336
|
-
return fetch(`${rootUrl}/datastore/query/${id}?${additionalParamsString}`).then((res)=>res.json());
|
|
1337
|
-
}
|
|
1359
|
+
const prevLimitRef = (0, $hgUW1$useRef)();
|
|
1360
|
+
const prevOffsetRef = (0, $hgUW1$useRef)();
|
|
1361
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1362
|
+
prevLimitRef.current = limit;
|
|
1363
|
+
prevOffsetRef.current = offset;
|
|
1338
1364
|
});
|
|
1365
|
+
const prevLimit = prevLimitRef.current;
|
|
1366
|
+
const prevOffset = prevOffsetRef.current;
|
|
1367
|
+
function fetchData() {
|
|
1368
|
+
let newOffset = prevLimit === limit ? prevOffset !== offset ? offset : 0 : 0;
|
|
1369
|
+
setOffset(newOffset);
|
|
1370
|
+
(0, $0e7628cf73c71646$export$55f990b5477765d6)(id, rootUrl, {
|
|
1371
|
+
keys: keys,
|
|
1372
|
+
limit: limit,
|
|
1373
|
+
offset: newOffset,
|
|
1374
|
+
conditions: conditions,
|
|
1375
|
+
sort: sort,
|
|
1376
|
+
groupings: groupings,
|
|
1377
|
+
prepareColumns: prepareColumns,
|
|
1378
|
+
properties: properties,
|
|
1379
|
+
setValues: setValues,
|
|
1380
|
+
setCount: setCount,
|
|
1381
|
+
setColumns: setColumns,
|
|
1382
|
+
setLoading: setLoading,
|
|
1383
|
+
setSchema: setSchema,
|
|
1384
|
+
setProperties: setProperties
|
|
1385
|
+
}, additionalParams);
|
|
1386
|
+
}
|
|
1339
1387
|
(0, $hgUW1$useEffect)(()=>{
|
|
1340
|
-
if (
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1388
|
+
if (!loading && !manual) {
|
|
1389
|
+
if (!requireConditions) fetchData();
|
|
1390
|
+
else if (requireConditions) {
|
|
1391
|
+
if (conditions && conditions.length) fetchData();
|
|
1392
|
+
else {
|
|
1393
|
+
setCount(null);
|
|
1394
|
+
setValues([]);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1345
1397
|
}
|
|
1346
1398
|
}, [
|
|
1347
|
-
|
|
1399
|
+
id,
|
|
1400
|
+
rootUrl,
|
|
1401
|
+
offset,
|
|
1402
|
+
conditions,
|
|
1403
|
+
sort,
|
|
1404
|
+
limit,
|
|
1405
|
+
requireConditions
|
|
1348
1406
|
]);
|
|
1349
1407
|
return {
|
|
1350
|
-
loading:
|
|
1408
|
+
loading: loading,
|
|
1351
1409
|
values: values,
|
|
1352
1410
|
count: count,
|
|
1353
1411
|
columns: columns,
|
|
@@ -1363,7 +1421,10 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
1363
1421
|
setLimit: setLimit,
|
|
1364
1422
|
setOffset: setOffset,
|
|
1365
1423
|
setConditions: setConditions,
|
|
1366
|
-
setSort: setSort
|
|
1424
|
+
setSort: setSort,
|
|
1425
|
+
setManual: setManual,
|
|
1426
|
+
setRequireConditions: setRequireConditions,
|
|
1427
|
+
fetchData: fetchData
|
|
1367
1428
|
};
|
|
1368
1429
|
};
|
|
1369
1430
|
var $1d3d480a9cfaabe0$export$2e2bcd8739ae039 = $1d3d480a9cfaabe0$var$useDatastore;
|
|
@@ -1613,90 +1674,101 @@ const $6da0396069e23175$export$bc27cf7ecf44639d = {
|
|
|
1613
1674
|
|
|
1614
1675
|
|
|
1615
1676
|
|
|
1616
|
-
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: header, sortElement: sortElement, setAriaLiveFeedback: setAriaLiveFeedback })=>{
|
|
1617
1680
|
const [columnResizing, setColumnResizing] = (0, $hgUW1$useState)("");
|
|
1681
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
|
|
1682
|
+
key: header.id,
|
|
1683
|
+
style: {
|
|
1684
|
+
width: header.getSize()
|
|
1685
|
+
},
|
|
1686
|
+
className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
|
|
1687
|
+
children: [
|
|
1688
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1689
|
+
className: "ds-u-display--flex",
|
|
1690
|
+
children: [
|
|
1691
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
1692
|
+
style: {
|
|
1693
|
+
maxWidth: header.getSize() - 16
|
|
1694
|
+
},
|
|
1695
|
+
children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
|
|
1696
|
+
}),
|
|
1697
|
+
sortElement && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
1698
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
1699
|
+
className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
|
|
1700
|
+
"aria-label": `${header.column.columnDef.header} sort order`
|
|
1701
|
+
})
|
|
1702
|
+
]
|
|
1703
|
+
}),
|
|
1704
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
1705
|
+
onMouseDown: header.getResizeHandler(),
|
|
1706
|
+
onTouchStart: header.getResizeHandler(),
|
|
1707
|
+
className: `dc-c-resize-handle ds-u-focus-visible ${header.column.getIsResizing() || header.column.id == columnResizing ? "isResizing" : ""}`,
|
|
1708
|
+
"aria-label": `Resize ${header.column.columnDef.header} column`,
|
|
1709
|
+
onKeyDown: (e)=>{
|
|
1710
|
+
const columnSizingObject = table.getState().columnSizing;
|
|
1711
|
+
switch(e.key){
|
|
1712
|
+
case "Enter":
|
|
1713
|
+
case " ":
|
|
1714
|
+
e.preventDefault();
|
|
1715
|
+
e.stopPropagation();
|
|
1716
|
+
if (columnResizing) {
|
|
1717
|
+
// end resizing
|
|
1718
|
+
setColumnResizing("");
|
|
1719
|
+
setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
|
|
1720
|
+
} else {
|
|
1721
|
+
// start resizing
|
|
1722
|
+
setColumnResizing(header.column.id);
|
|
1723
|
+
setAriaLiveFeedback(`${header.column.columnDef.header} grabbed.`);
|
|
1724
|
+
}
|
|
1725
|
+
break;
|
|
1726
|
+
case "Escape":
|
|
1727
|
+
if (columnResizing) {
|
|
1728
|
+
setColumnResizing("");
|
|
1729
|
+
setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
|
|
1730
|
+
}
|
|
1731
|
+
break;
|
|
1732
|
+
case "ArrowRight":
|
|
1733
|
+
e.preventDefault();
|
|
1734
|
+
e.stopPropagation();
|
|
1735
|
+
if (columnResizing) {
|
|
1736
|
+
columnSizingObject[header.column.id] = header.getSize() + 10;
|
|
1737
|
+
table.setColumnSizing(columnSizingObject);
|
|
1738
|
+
setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
|
|
1739
|
+
}
|
|
1740
|
+
break;
|
|
1741
|
+
case "ArrowLeft":
|
|
1742
|
+
e.preventDefault();
|
|
1743
|
+
e.stopPropagation();
|
|
1744
|
+
if (columnResizing) {
|
|
1745
|
+
columnSizingObject[header.column.id] = header.getSize() - 10;
|
|
1746
|
+
table.setColumnSizing(columnSizingObject);
|
|
1747
|
+
setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
|
|
1748
|
+
}
|
|
1749
|
+
break;
|
|
1750
|
+
}
|
|
1751
|
+
},
|
|
1752
|
+
onBlur: ()=>{
|
|
1753
|
+
setColumnResizing("");
|
|
1754
|
+
}
|
|
1755
|
+
})
|
|
1756
|
+
]
|
|
1757
|
+
});
|
|
1758
|
+
};
|
|
1759
|
+
var $64a351d3fd8413c3$export$2e2bcd8739ae039 = $64a351d3fd8413c3$var$HeaderResizeElement;
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
const $96d341d082bffec5$var$TruncatedResizeableTHead = ({ table: table, sortElement: sortElement = null, setAriaLiveFeedback: setAriaLiveFeedback })=>{
|
|
1618
1763
|
return /*#__PURE__*/ (0, $hgUW1$jsx)("thead", {
|
|
1619
1764
|
className: "dc-thead--truncated dc-thead--resizeable",
|
|
1620
1765
|
children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)("tr", {
|
|
1621
|
-
children: headerGroup.headers.map((header)
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
title: header.column.columnDef.header,
|
|
1628
|
-
className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold dc-c-table-header-cell",
|
|
1629
|
-
children: [
|
|
1630
|
-
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1631
|
-
children: [
|
|
1632
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
1633
|
-
style: {
|
|
1634
|
-
maxWidth: header.getSize() - 16
|
|
1635
|
-
},
|
|
1636
|
-
children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
|
|
1637
|
-
}),
|
|
1638
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
1639
|
-
onClick: header.column.getToggleSortingHandler(),
|
|
1640
|
-
className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
|
|
1641
|
-
"aria-label": `${header.column.columnDef.header} sort order`
|
|
1642
|
-
})
|
|
1643
|
-
]
|
|
1644
|
-
}),
|
|
1645
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
1646
|
-
onMouseDown: header.getResizeHandler(),
|
|
1647
|
-
onTouchStart: header.getResizeHandler(),
|
|
1648
|
-
className: `dc-c-resize-handle ds-u-focus-visible ${header.column.getIsResizing() || header.column.id == columnResizing ? "isResizing" : ""}`,
|
|
1649
|
-
"aria-label": `Resize ${header.column.columnDef.header} column`,
|
|
1650
|
-
onKeyDown: (e)=>{
|
|
1651
|
-
const columnSizingObject = table.getState().columnSizing;
|
|
1652
|
-
switch(e.key){
|
|
1653
|
-
case "Enter":
|
|
1654
|
-
case " ":
|
|
1655
|
-
e.preventDefault();
|
|
1656
|
-
e.stopPropagation();
|
|
1657
|
-
if (columnResizing) {
|
|
1658
|
-
// end resizing
|
|
1659
|
-
setColumnResizing("");
|
|
1660
|
-
setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
|
|
1661
|
-
} else {
|
|
1662
|
-
// start resizing
|
|
1663
|
-
setColumnResizing(header.column.id);
|
|
1664
|
-
setAriaLiveFeedback(`${header.column.columnDef.header} grabbed.`);
|
|
1665
|
-
}
|
|
1666
|
-
break;
|
|
1667
|
-
case "Escape":
|
|
1668
|
-
if (columnResizing) {
|
|
1669
|
-
setColumnResizing("");
|
|
1670
|
-
setAriaLiveFeedback(`${header.column.columnDef.header} dropped.`);
|
|
1671
|
-
}
|
|
1672
|
-
break;
|
|
1673
|
-
case "ArrowRight":
|
|
1674
|
-
e.preventDefault();
|
|
1675
|
-
e.stopPropagation();
|
|
1676
|
-
if (columnResizing) {
|
|
1677
|
-
columnSizingObject[header.column.id] = header.getSize() + 10;
|
|
1678
|
-
table.setColumnSizing(columnSizingObject);
|
|
1679
|
-
setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
|
|
1680
|
-
}
|
|
1681
|
-
break;
|
|
1682
|
-
case "ArrowLeft":
|
|
1683
|
-
e.preventDefault();
|
|
1684
|
-
e.stopPropagation();
|
|
1685
|
-
if (columnResizing) {
|
|
1686
|
-
columnSizingObject[header.column.id] = header.getSize() - 10;
|
|
1687
|
-
table.setColumnSizing(columnSizingObject);
|
|
1688
|
-
setAriaLiveFeedback(`${header.column.columnDef.header} has been resized. The new width is ${header.getSize()} pixels.`);
|
|
1689
|
-
}
|
|
1690
|
-
break;
|
|
1691
|
-
}
|
|
1692
|
-
},
|
|
1693
|
-
onBlur: ()=>{
|
|
1694
|
-
setColumnResizing("");
|
|
1695
|
-
}
|
|
1696
|
-
})
|
|
1697
|
-
]
|
|
1698
|
-
});
|
|
1699
|
-
})
|
|
1766
|
+
children: headerGroup.headers.map((header)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $64a351d3fd8413c3$export$2e2bcd8739ae039), {
|
|
1767
|
+
table: table,
|
|
1768
|
+
header: header,
|
|
1769
|
+
sortElement: sortElement,
|
|
1770
|
+
setAriaLiveFeedback: setAriaLiveFeedback
|
|
1771
|
+
}))
|
|
1700
1772
|
}, headerGroup.id))
|
|
1701
1773
|
});
|
|
1702
1774
|
};
|
|
@@ -1717,9 +1789,10 @@ const $23763e27eda0e8d7$var$FixedSizeTHead = ({ table: table, sortElement: sortE
|
|
|
1717
1789
|
width: header.getSize()
|
|
1718
1790
|
},
|
|
1719
1791
|
title: header.column.columnDef.header,
|
|
1720
|
-
className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold
|
|
1792
|
+
className: "ds-u-border-y--2 ds-u-padding--2 ds-u-border--dark ds-u-font-weight--bold",
|
|
1721
1793
|
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
1722
1794
|
onClick: header.column.getToggleSortingHandler(),
|
|
1795
|
+
className: "ds-u-display--flex",
|
|
1723
1796
|
children: [
|
|
1724
1797
|
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
1725
1798
|
children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
|
|
@@ -2133,15 +2206,8 @@ var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHe
|
|
|
2133
2206
|
|
|
2134
2207
|
const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
|
|
2135
2208
|
const { fields: fields } = schema;
|
|
2136
|
-
|
|
2137
|
-
children: "
|
|
2138
|
-
});
|
|
2139
|
-
if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
|
|
2140
|
-
className: "ds-u-margin-y--0",
|
|
2141
|
-
children: [
|
|
2142
|
-
prependedMessage,
|
|
2143
|
-
" none"
|
|
2144
|
-
]
|
|
2209
|
+
if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
2210
|
+
children: "Add a filter"
|
|
2145
2211
|
});
|
|
2146
2212
|
function formatValue(text, property) {
|
|
2147
2213
|
if (customColumns && customColumns.length > 0) {
|
|
@@ -2153,48 +2219,42 @@ const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: sche
|
|
|
2153
2219
|
return text;
|
|
2154
2220
|
} else return text;
|
|
2155
2221
|
}
|
|
2156
|
-
return /*#__PURE__*/ (0, $hgUW1$
|
|
2222
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2157
2223
|
className: "dc-querybuilder-title",
|
|
2158
|
-
children:
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
|
|
2171
|
-
children: [
|
|
2172
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2173
|
-
className: "ds-u-font-weight--bold",
|
|
2174
|
-
children: description
|
|
2175
|
-
}),
|
|
2176
|
-
" ",
|
|
2177
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2178
|
-
className: "ds-u-font-weight--normal",
|
|
2179
|
-
children: operator.label.toUpperCase()
|
|
2180
|
-
}),
|
|
2181
|
-
" ",
|
|
2182
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2183
|
-
className: "ds-u-color--success",
|
|
2184
|
-
children: formattedText
|
|
2185
|
-
})
|
|
2186
|
-
]
|
|
2187
|
-
});
|
|
2188
|
-
}).reduce((prev, curr)=>[
|
|
2189
|
-
prev,
|
|
2190
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
2191
|
-
className: "ds-u-margin-x--1",
|
|
2192
|
-
variation: "info",
|
|
2193
|
-
children: "AND"
|
|
2224
|
+
children: conditions.map((c)=>{
|
|
2225
|
+
const field = fields[c.property];
|
|
2226
|
+
const description = field && field.description ? field.description : c.property;
|
|
2227
|
+
const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
|
|
2228
|
+
const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
|
|
2229
|
+
const formattedText = formatValue(cleanedText, c.property);
|
|
2230
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2231
|
+
className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
|
|
2232
|
+
children: [
|
|
2233
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2234
|
+
className: "ds-u-font-weight--bold",
|
|
2235
|
+
children: description
|
|
2194
2236
|
}),
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2237
|
+
" ",
|
|
2238
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2239
|
+
className: "ds-u-font-weight--normal",
|
|
2240
|
+
children: operator.label.toUpperCase()
|
|
2241
|
+
}),
|
|
2242
|
+
" ",
|
|
2243
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2244
|
+
className: "ds-u-color--success",
|
|
2245
|
+
children: formattedText
|
|
2246
|
+
})
|
|
2247
|
+
]
|
|
2248
|
+
});
|
|
2249
|
+
}).reduce((prev, curr)=>[
|
|
2250
|
+
prev,
|
|
2251
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
2252
|
+
className: "ds-u-margin-x--1",
|
|
2253
|
+
variation: "info",
|
|
2254
|
+
children: "AND"
|
|
2255
|
+
}),
|
|
2256
|
+
curr
|
|
2257
|
+
])
|
|
2198
2258
|
});
|
|
2199
2259
|
};
|
|
2200
2260
|
var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
|
|
@@ -2713,8 +2773,9 @@ const $0958733ee130fc44$var$ResourceInformation = ({ resource: resource })=>{
|
|
|
2713
2773
|
var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
|
|
2714
2774
|
|
|
2715
2775
|
|
|
2716
|
-
|
|
2717
|
-
|
|
2776
|
+
|
|
2777
|
+
const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource: resource, title: title })=>{
|
|
2778
|
+
function getFormatType(dist) {
|
|
2718
2779
|
if (dist.data.format) return dist.data.format.toLowerCase();
|
|
2719
2780
|
if (dist.data.mediaType) {
|
|
2720
2781
|
const mediaType = dist.data.mediaType.split("/");
|
|
@@ -2726,13 +2787,8 @@ function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
|
|
|
2726
2787
|
if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
|
|
2727
2788
|
}
|
|
2728
2789
|
}
|
|
2790
|
+
return "";
|
|
2729
2791
|
}
|
|
2730
|
-
return "";
|
|
2731
|
-
}
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource: resource, title: title })=>{
|
|
2736
2792
|
const sm = (0, $hgUW1$useMediaQuery)({
|
|
2737
2793
|
minWidth: 0,
|
|
2738
2794
|
maxWidth: 767
|
|
@@ -2744,10 +2800,10 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
|
|
|
2744
2800
|
className: "ds-l-col--12 ds-u-padding-left--0 ds-text-heading--2xl",
|
|
2745
2801
|
children: "Resources"
|
|
2746
2802
|
}),
|
|
2747
|
-
distributions.length
|
|
2803
|
+
distributions.length && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
2748
2804
|
className: "ds-c-list ds-c-list--bare dc-c-resource-full-width",
|
|
2749
2805
|
children: distributions.map((dist)=>{
|
|
2750
|
-
const fileFormat = (
|
|
2806
|
+
const fileFormat = getFormatType(dist);
|
|
2751
2807
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("li", {
|
|
2752
2808
|
className: `ds-u-display--flex ds-u-flex-wrap--wrap ${fileFormat !== "csv" && "ds-u-margin-bottom--2"}`,
|
|
2753
2809
|
children: [
|
|
@@ -2787,8 +2843,6 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
|
|
|
2787
2843
|
]
|
|
2788
2844
|
}, dist.identifier);
|
|
2789
2845
|
})
|
|
2790
|
-
}) : /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2791
|
-
className: "ds-u-margin-top--2"
|
|
2792
2846
|
})
|
|
2793
2847
|
]
|
|
2794
2848
|
});
|
|
@@ -2917,11 +2971,106 @@ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
|
|
|
2917
2971
|
|
|
2918
2972
|
|
|
2919
2973
|
|
|
2920
|
-
|
|
2974
|
+
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
|
|
2978
|
+
|
|
2979
|
+
|
|
2980
|
+
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, count: count, pageSize: pageSize })=>{
|
|
2921
2984
|
const [pagination, setPagination] = (0, $hgUW1$useState)({
|
|
2922
2985
|
pageIndex: 1,
|
|
2923
2986
|
pageSize: pageSize
|
|
2924
2987
|
});
|
|
2988
|
+
const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
|
|
2989
|
+
const table = (0, $hgUW1$useReactTable)({
|
|
2990
|
+
data: tableData,
|
|
2991
|
+
columns: tableColumns,
|
|
2992
|
+
columnResizeMode: "onChange",
|
|
2993
|
+
getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
|
|
2994
|
+
getPaginationRowModel: (0, $hgUW1$getPaginationRowModel)(),
|
|
2995
|
+
onPaginationChange: setPagination,
|
|
2996
|
+
state: {
|
|
2997
|
+
pagination: pagination
|
|
2998
|
+
}
|
|
2999
|
+
});
|
|
3000
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3001
|
+
children: [
|
|
3002
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3003
|
+
className: "dc-c-datadictionary-table",
|
|
3004
|
+
children: [
|
|
3005
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Table), {
|
|
3006
|
+
className: "dc-c-datatable",
|
|
3007
|
+
style: {
|
|
3008
|
+
width: "100%"
|
|
3009
|
+
},
|
|
3010
|
+
children: [
|
|
3011
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
|
|
3012
|
+
className: "dc-thead--truncated dc-thead--resizeable",
|
|
3013
|
+
children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
|
|
3014
|
+
children: headerGroup.headers.map((header)=>{
|
|
3015
|
+
return header.id === "titleResizable" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $64a351d3fd8413c3$export$2e2bcd8739ae039), {
|
|
3016
|
+
table: table,
|
|
3017
|
+
header: header,
|
|
3018
|
+
setAriaLiveFeedback: setAriaLiveFeedback
|
|
3019
|
+
}, header.id + "_resize") : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
3020
|
+
key: header.id,
|
|
3021
|
+
className: "ds-u-border-y--2 ds-u-border--dark ds-u-border-x--0",
|
|
3022
|
+
children: (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
|
|
3023
|
+
});
|
|
3024
|
+
})
|
|
3025
|
+
}, "header" + headerGroup.id))
|
|
3026
|
+
}),
|
|
3027
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
|
|
3028
|
+
children: table.getRowModel().rows.map((row, index)=>{
|
|
3029
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
|
|
3030
|
+
children: row.getVisibleCells().map((cell)=>{
|
|
3031
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
3032
|
+
key: cell.id,
|
|
3033
|
+
style: {
|
|
3034
|
+
maxWidth: cell.column.getSize()
|
|
3035
|
+
},
|
|
3036
|
+
className: `${cell.column.id === "titleResizable" ? "ds-u-word-break" : ""}`,
|
|
3037
|
+
children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
3038
|
+
});
|
|
3039
|
+
})
|
|
3040
|
+
}, index + JSON.stringify(row));
|
|
3041
|
+
})
|
|
3042
|
+
})
|
|
3043
|
+
]
|
|
3044
|
+
}),
|
|
3045
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3046
|
+
className: "sr-only",
|
|
3047
|
+
"aria-live": "assertive",
|
|
3048
|
+
"aria-atomic": "true",
|
|
3049
|
+
children: ariaLiveFeedback
|
|
3050
|
+
})
|
|
3051
|
+
]
|
|
3052
|
+
}),
|
|
3053
|
+
count > pageSize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
|
|
3054
|
+
totalPages: Math.ceil(count / pagination.pageSize),
|
|
3055
|
+
currentPage: pagination.pageIndex + 1,
|
|
3056
|
+
onPageChange: (evt, page)=>{
|
|
3057
|
+
evt.preventDefault();
|
|
3058
|
+
setPagination({
|
|
3059
|
+
pageIndex: page - 1,
|
|
3060
|
+
pageSize: pageSize
|
|
3061
|
+
});
|
|
3062
|
+
},
|
|
3063
|
+
renderHref: (page)=>{
|
|
3064
|
+
return "";
|
|
3065
|
+
}
|
|
3066
|
+
}) : ""
|
|
3067
|
+
]
|
|
3068
|
+
});
|
|
3069
|
+
};
|
|
3070
|
+
var $6765a74df807d015$export$2e2bcd8739ae039 = $6765a74df807d015$var$DataDictionaryTable;
|
|
3071
|
+
|
|
3072
|
+
|
|
3073
|
+
const $a24829b27758fe6c$var$SitewideDataDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
|
|
2925
3074
|
const columnHelper = (0, $hgUW1$createColumnHelper)();
|
|
2926
3075
|
const tableColumns = [
|
|
2927
3076
|
columnHelper.accessor("name", {
|
|
@@ -2937,67 +3086,117 @@ const $6012b86ffcaf3f71$var$DataDictionary = ({ datasetDictionary: datasetDictio
|
|
|
2937
3086
|
header: "Format"
|
|
2938
3087
|
})
|
|
2939
3088
|
];
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
3089
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
|
|
3090
|
+
tableColumns: tableColumns,
|
|
3091
|
+
tableData: datasetDictionary,
|
|
3092
|
+
count: datasetDictionary.length,
|
|
3093
|
+
pageSize: pageSize
|
|
3094
|
+
});
|
|
3095
|
+
};
|
|
3096
|
+
var $a24829b27758fe6c$export$2e2bcd8739ae039 = $a24829b27758fe6c$var$SitewideDataDictionaryTable;
|
|
3097
|
+
|
|
3098
|
+
|
|
3099
|
+
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
|
|
3103
|
+
|
|
3104
|
+
|
|
3105
|
+
const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
|
|
3106
|
+
const tableData = datasetDictionary.map((item)=>{
|
|
3107
|
+
return {
|
|
3108
|
+
titleResizable: item.title,
|
|
3109
|
+
description: item.description,
|
|
3110
|
+
type: item.type
|
|
3111
|
+
};
|
|
3112
|
+
});
|
|
3113
|
+
const columnHelper = (0, $hgUW1$createColumnHelper)();
|
|
3114
|
+
const tableColumns = [
|
|
3115
|
+
columnHelper.accessor("titleResizable", {
|
|
3116
|
+
header: ()=>/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3117
|
+
className: "dc-c-tooltip-width-override",
|
|
3118
|
+
children: [
|
|
3119
|
+
"Title",
|
|
3120
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
|
|
3121
|
+
title: "Title represents the column headers of the data file (e.g., Change_Type)",
|
|
3122
|
+
// @ts-ignore
|
|
3123
|
+
style: {
|
|
3124
|
+
border: "none",
|
|
3125
|
+
background: "none"
|
|
3126
|
+
},
|
|
3127
|
+
maxWidth: "400px",
|
|
3128
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TooltipIcon), {})
|
|
3129
|
+
})
|
|
3130
|
+
]
|
|
3131
|
+
}),
|
|
3132
|
+
size: 300
|
|
3133
|
+
}),
|
|
3134
|
+
columnHelper.accessor("description", {
|
|
3135
|
+
header: "Description",
|
|
3136
|
+
minSize: 600
|
|
3137
|
+
}),
|
|
3138
|
+
columnHelper.accessor("type", {
|
|
3139
|
+
header: "Type",
|
|
3140
|
+
size: 150,
|
|
3141
|
+
enableResizing: false
|
|
3142
|
+
})
|
|
3143
|
+
];
|
|
3144
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
|
|
3145
|
+
tableColumns: tableColumns,
|
|
3146
|
+
tableData: tableData,
|
|
3147
|
+
count: datasetDictionary.length,
|
|
3148
|
+
pageSize: pageSize
|
|
3149
|
+
});
|
|
3150
|
+
};
|
|
3151
|
+
var $a6e312940f7003ef$export$2e2bcd8739ae039 = $a6e312940f7003ef$var$DatasetDictionaryTable;
|
|
3152
|
+
|
|
3153
|
+
|
|
3154
|
+
|
|
3155
|
+
const $6012b86ffcaf3f71$var$DataDictionary = ({ datasetDictionaryEndpoint: datasetDictionaryEndpoint, datasetSitewideDictionary: datasetSitewideDictionary, title: title, pageSize: pageSize = 20, additionalParams: additionalParams })=>{
|
|
3156
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
3157
|
+
queryKey: [
|
|
3158
|
+
"dictionary" + datasetDictionaryEndpoint
|
|
3159
|
+
],
|
|
3160
|
+
queryFn: ()=>{
|
|
3161
|
+
return fetch(`${datasetDictionaryEndpoint}?${(0, $hgUW1$qs).stringify(additionalParams, {
|
|
3162
|
+
arrayFormat: "comma",
|
|
3163
|
+
encode: false
|
|
3164
|
+
})}`).then((res)=>res.json());
|
|
2948
3165
|
}
|
|
2949
3166
|
});
|
|
3167
|
+
const datasetDictionary = data && data.data && data.data.fields.length ? data.data.fields : null;
|
|
2950
3168
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
2951
3169
|
children: [
|
|
2952
3170
|
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
2953
3171
|
className: "ds-text-heading--2xl ds-u-margin-y--3",
|
|
2954
3172
|
children: title
|
|
2955
3173
|
}),
|
|
2956
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
|
|
2971
|
-
children: table.getRowModel().rows.map((row, index)=>{
|
|
2972
|
-
const even = (index + 1) % 2 === 0;
|
|
2973
|
-
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
|
|
2974
|
-
className: `${even ? "dc-c-datatable--even-row" : ""}`,
|
|
2975
|
-
children: row.getVisibleCells().map((cell)=>{
|
|
2976
|
-
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
|
|
2977
|
-
key: cell.id,
|
|
2978
|
-
children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
2979
|
-
});
|
|
2980
|
-
})
|
|
2981
|
-
});
|
|
2982
|
-
})
|
|
3174
|
+
datasetDictionary && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
3175
|
+
children: [
|
|
3176
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3177
|
+
className: "ds-u-margin-bottom--1 ds-u-display--flex ds-u-justify-content--end",
|
|
3178
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Button), {
|
|
3179
|
+
className: "ds-l-col--12 ds-l-sm-col--6 ds-l-md-col--4",
|
|
3180
|
+
onClick: ()=>window.open(datasetDictionaryEndpoint),
|
|
3181
|
+
type: "button",
|
|
3182
|
+
children: [
|
|
3183
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3184
|
+
className: "fa fa-file-download ds-u-color--primary ds-u-padding-right--1"
|
|
3185
|
+
}),
|
|
3186
|
+
" View Dictionary JSON"
|
|
3187
|
+
]
|
|
2983
3188
|
})
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
datasetDictionary.length > pageSize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
|
|
2988
|
-
totalPages: Math.ceil(datasetDictionary.length / pagination.pageSize),
|
|
2989
|
-
currentPage: pagination.pageIndex + 1,
|
|
2990
|
-
onPageChange: (evt, page)=>{
|
|
2991
|
-
evt.preventDefault();
|
|
2992
|
-
setPagination({
|
|
2993
|
-
pageIndex: page - 1,
|
|
3189
|
+
}),
|
|
3190
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $a6e312940f7003ef$export$2e2bcd8739ae039), {
|
|
3191
|
+
datasetDictionary: datasetDictionary,
|
|
2994
3192
|
pageSize: pageSize
|
|
2995
|
-
})
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3193
|
+
})
|
|
3194
|
+
]
|
|
3195
|
+
}),
|
|
3196
|
+
datasetSitewideDictionary && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a24829b27758fe6c$export$2e2bcd8739ae039), {
|
|
3197
|
+
datasetDictionary: datasetSitewideDictionary,
|
|
3198
|
+
pageSize: pageSize
|
|
3199
|
+
})
|
|
3001
3200
|
]
|
|
3002
3201
|
});
|
|
3003
3202
|
};
|
|
@@ -3006,18 +3205,20 @@ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
|
|
|
3006
3205
|
|
|
3007
3206
|
|
|
3008
3207
|
|
|
3009
|
-
|
|
3010
|
-
const $a0f13962e513caa1$var$getSiteWideDataDictionary = (rootUrl, dataDictionaryUrl)=>{
|
|
3208
|
+
const $a0f13962e513caa1$var$getDataDictionary = (dataDictionaryUrl, additionalParams)=>{
|
|
3011
3209
|
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
3012
3210
|
queryKey: [
|
|
3013
|
-
"dictionary"
|
|
3211
|
+
"dictionary" + dataDictionaryUrl
|
|
3014
3212
|
],
|
|
3015
3213
|
queryFn: ()=>{
|
|
3016
|
-
return fetch(
|
|
3214
|
+
return fetch(`${dataDictionaryUrl}?${(0, $hgUW1$qs).stringify(additionalParams, {
|
|
3215
|
+
arrayFormat: "comma",
|
|
3216
|
+
encode: false
|
|
3217
|
+
})}`).then((res)=>res.json());
|
|
3017
3218
|
}
|
|
3018
3219
|
});
|
|
3019
3220
|
return {
|
|
3020
|
-
|
|
3221
|
+
dataDictionary: data,
|
|
3021
3222
|
dataDictionaryLoading: isPending
|
|
3022
3223
|
};
|
|
3023
3224
|
};
|
|
@@ -3029,7 +3230,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3029
3230
|
} : {
|
|
3030
3231
|
conditions: []
|
|
3031
3232
|
};
|
|
3032
|
-
const { dataset: dataset
|
|
3233
|
+
const { dataset: dataset } = (0, $b4aa9c66f2e86959$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
|
|
3033
3234
|
const title = dataset.title ? dataset.title : "";
|
|
3034
3235
|
const metadataMapping = {
|
|
3035
3236
|
...(0, $6da0396069e23175$export$bc27cf7ecf44639d),
|
|
@@ -3043,17 +3244,25 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3043
3244
|
limit: defaultPageSize,
|
|
3044
3245
|
manual: true
|
|
3045
3246
|
}, additionalParams);
|
|
3046
|
-
const
|
|
3047
|
-
siteWideDataDictionary: null
|
|
3048
|
-
};
|
|
3247
|
+
const siteWideDataDictionary = dataDictionaryUrl ? $a0f13962e513caa1$var$getDataDictionary(rootUrl + dataDictionaryUrl, additionalParams).dataDictionary : null;
|
|
3049
3248
|
// compare schema fields with siteWideDataDictionary to display commonalities for now
|
|
3050
3249
|
// until dataset level data dictionaries are implemented
|
|
3051
|
-
const
|
|
3250
|
+
const datasetSitewideDictionary = siteWideDataDictionary && resource && resource.schema[distribution.identifier] ? siteWideDataDictionary.data.fields.filter((field)=>{
|
|
3052
3251
|
return Object.keys(resource.schema[distribution.identifier].fields).indexOf(field.name) !== -1;
|
|
3053
3252
|
}) : null;
|
|
3054
3253
|
(0, $hgUW1$useEffect)(()=>{
|
|
3055
|
-
|
|
3056
|
-
|
|
3254
|
+
if (distribution.identifier) {
|
|
3255
|
+
let localFileFormat = "";
|
|
3256
|
+
if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
|
|
3257
|
+
else if (distribution.data.mediaType) {
|
|
3258
|
+
const mediaType = distribution.data.mediaType.split("/");
|
|
3259
|
+
if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
|
|
3260
|
+
}
|
|
3261
|
+
if (localFileFormat === "CSV") {
|
|
3262
|
+
resource.setResource(distribution.identifier);
|
|
3263
|
+
resource.setManual(false);
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3057
3266
|
}, [
|
|
3058
3267
|
distribution
|
|
3059
3268
|
]);
|
|
@@ -3095,17 +3304,6 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3095
3304
|
})
|
|
3096
3305
|
]
|
|
3097
3306
|
});
|
|
3098
|
-
// The below code manages the selected tab in the Design System tab group manually to ensure we can still use the
|
|
3099
|
-
// Data Table tab as the default since it no longer exists on initial render (By default, Overview will appear as default)
|
|
3100
|
-
const getDefaultTab = ()=>{
|
|
3101
|
-
return (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv" ? "data-table" : "overview";
|
|
3102
|
-
};
|
|
3103
|
-
const [selectedTab, setSelectedTab] = (0, $hgUW1$useState)(window.location.hash.substring(1) ? window.location.hash.substring(1) : getDefaultTab());
|
|
3104
|
-
(0, $hgUW1$useEffect)(()=>{
|
|
3105
|
-
setSelectedTab(getDefaultTab());
|
|
3106
|
-
}, [
|
|
3107
|
-
distribution
|
|
3108
|
-
]);
|
|
3109
3307
|
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
3110
3308
|
children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
|
|
3111
3309
|
content: notFoundContent,
|
|
@@ -3153,13 +3351,11 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3153
3351
|
className: "ds-l-row",
|
|
3154
3352
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3155
3353
|
className: "ds-l-md-col--12 dc-dataset",
|
|
3156
|
-
children:
|
|
3157
|
-
onChange: (
|
|
3158
|
-
|
|
3159
|
-
},
|
|
3160
|
-
selectedId: selectedTab,
|
|
3354
|
+
children: distribution && distribution.data && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tabs), {
|
|
3355
|
+
onChange: function noRefCheck() {},
|
|
3356
|
+
defaultSelectedId: window.location.hash.substring(1),
|
|
3161
3357
|
children: [
|
|
3162
|
-
|
|
3358
|
+
distribution.data.format === "csv" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3163
3359
|
id: "data-table",
|
|
3164
3360
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3165
3361
|
className: "ds-u-color--primary",
|
|
@@ -3198,7 +3394,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3198
3394
|
metadataMapping: metadataMapping
|
|
3199
3395
|
})
|
|
3200
3396
|
}),
|
|
3201
|
-
distribution && distribution.data &&
|
|
3397
|
+
distribution.data && distribution.data.describedBy && distribution.data.describedByType === "application/vnd.tableschema+json" || datasetSitewideDictionary && datasetSitewideDictionary.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3202
3398
|
id: "data-dictionary",
|
|
3203
3399
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3204
3400
|
className: "ds-u-color--primary",
|
|
@@ -3211,11 +3407,13 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3211
3407
|
}),
|
|
3212
3408
|
className: borderlessTabs ? "ds-u-border--0 ds-u-padding-x--0" : "",
|
|
3213
3409
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6012b86ffcaf3f71$export$2e2bcd8739ae039), {
|
|
3214
|
-
|
|
3215
|
-
|
|
3410
|
+
datasetSitewideDictionary: datasetSitewideDictionary,
|
|
3411
|
+
datasetDictionaryEndpoint: distribution.data.describedBy,
|
|
3412
|
+
title: "Data Dictionary",
|
|
3413
|
+
additionalParams: additionalParams
|
|
3216
3414
|
})
|
|
3217
3415
|
}) : null,
|
|
3218
|
-
|
|
3416
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3219
3417
|
id: "api",
|
|
3220
3418
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3221
3419
|
className: "ds-u-color--primary",
|
|
@@ -5369,7 +5567,10 @@ const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id, dataset: dataset,
|
|
|
5369
5567
|
manual: true
|
|
5370
5568
|
}, additionalParams);
|
|
5371
5569
|
(0, $hgUW1$useEffect)(()=>{
|
|
5372
|
-
if (distribution.identifier)
|
|
5570
|
+
if (distribution.identifier) {
|
|
5571
|
+
resource.setResource(distribution.identifier);
|
|
5572
|
+
resource.setManual(false);
|
|
5573
|
+
}
|
|
5373
5574
|
}, [
|
|
5374
5575
|
distribution
|
|
5375
5576
|
]);
|
|
@@ -5590,6 +5791,5 @@ var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollTo
|
|
|
5590
5791
|
|
|
5591
5792
|
|
|
5592
5793
|
|
|
5593
|
-
|
|
5594
|
-
export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $a0f13962e513caa1$export$2e2bcd8739ae039 as Dataset, $a35cf16d1488f54e$export$2e2bcd8739ae039 as DatasetTable, $a5a6a06d249c33b8$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $669d2782ec2e2250$export$2e2bcd8739ae039 as SpecsAndLimits, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI, $1d3d480a9cfaabe0$export$2e2bcd8739ae039 as useDatastore, $aa4450dcbeef3ac0$export$385a5aba38cc3325 as transformTableSortToQuerySort, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $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, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $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, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $b4aa9c66f2e86959$export$2e2bcd8739ae039 as useMetastoreDataset, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 as withQueryProvider, $6da0396069e23175$export$bc27cf7ecf44639d as defaultMetadataMapping, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults};
|
|
5794
|
+
export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $a0f13962e513caa1$export$2e2bcd8739ae039 as Dataset, $a35cf16d1488f54e$export$2e2bcd8739ae039 as DatasetTable, $a5a6a06d249c33b8$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $669d2782ec2e2250$export$2e2bcd8739ae039 as SpecsAndLimits, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI, $1d3d480a9cfaabe0$export$2e2bcd8739ae039 as useDatastore, $aa4450dcbeef3ac0$export$385a5aba38cc3325 as transformTableSortToQuerySort, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $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, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $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, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $b4aa9c66f2e86959$export$2e2bcd8739ae039 as useMetastoreDataset, $6da0396069e23175$export$bc27cf7ecf44639d as defaultMetadataMapping, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults};
|
|
5595
5795
|
//# sourceMappingURL=main.js.map
|