@civicactions/cmsds-open-data-components 4.0.8-alpha.3 → 4.0.9-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
@@ -2260,6 +2260,8 @@ function $7264a673914aa746$export$2b9377795161999(type) {
2260
2260
 
2261
2261
  const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: header, sortElement: sortElement, setAriaLiveFeedback: setAriaLiveFeedback, id: id })=>{
2262
2262
  const [columnResizing, setColumnResizing] = (0, $hgUW1$useState)("");
2263
+ // Fix for JSX in Data Dictionary Title header cell
2264
+ const ariaLabel = header.id === "titleResizable" ? "Title" : header.column.columnDef.header;
2263
2265
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("th", {
2264
2266
  key: header.id,
2265
2267
  style: {
@@ -2281,7 +2283,7 @@ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: heade
2281
2283
  sortElement && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
2282
2284
  onClick: header.column.getToggleSortingHandler(),
2283
2285
  className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
2284
- "aria-label": `${header.column.columnDef.header} sort order`
2286
+ "aria-label": `${ariaLabel} sort order`
2285
2287
  })
2286
2288
  ]
2287
2289
  }),
@@ -2289,7 +2291,7 @@ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: heade
2289
2291
  onMouseDown: header.getResizeHandler(),
2290
2292
  onTouchStart: header.getResizeHandler(),
2291
2293
  className: `dc-c-resize-handle ds-u-focus-visible ${header.column.getIsResizing() || header.column.id == columnResizing ? "isResizing" : ""}`,
2292
- "aria-label": `Resize ${header.column.columnDef.header} column`,
2294
+ "aria-label": `Resize ${ariaLabel} column`,
2293
2295
  onKeyDown: (e)=>{
2294
2296
  const columnSizingObject = table.getState().columnSizing;
2295
2297
  switch(e.key){
@@ -5208,13 +5210,15 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
5208
5210
  if (!requireConditions) enabled = true;
5209
5211
  if (conditions && conditions.length) enabled = true;
5210
5212
  }
5213
+ // Change whether distribution API or dataset API is used based on option
5214
+ const queryID = options.useDatasetAPI ? params.datasetID + "/0" : id;
5211
5215
  const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
5212
5216
  queryKey: [
5213
5217
  "datastore" + id + paramsString
5214
5218
  ],
5215
5219
  queryFn: ()=>{
5216
5220
  setCount(null);
5217
- return fetch(`${rootUrl}/datastore/query/${id}?${paramsString}`).then((res)=>res.json());
5221
+ return fetch(`${rootUrl}/datastore/query/${queryID}?${paramsString}`).then((res)=>res.json());
5218
5222
  },
5219
5223
  enabled: enabled
5220
5224
  });
@@ -5228,7 +5232,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
5228
5232
  count: true,
5229
5233
  schema: true
5230
5234
  };
5231
- return fetch(`${rootUrl}/datastore/query/${id}?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(unfilteredParams, ACA))}`).then((res)=>res.json());
5235
+ return fetch(`${rootUrl}/datastore/query/${queryID}?${(0, $hgUW1$qs).stringify((0, $6d5c0212e738499b$export$34e95918366a058e)(unfilteredParams, ACA))}`).then((res)=>res.json());
5232
5236
  }
5233
5237
  });
5234
5238
  (0, $hgUW1$useEffect)(()=>{
@@ -6341,7 +6345,7 @@ const $a0f13962e513caa1$var$getDataDictionary = (dataDictionaryUrl)=>{
6341
6345
  dataDictionaryLoading: isPending
6342
6346
  };
6343
6347
  };
6344
- const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns: customColumns, setDatasetTitle: setDatasetTitle, customMetadataMapping: customMetadataMapping, apiPageUrl: apiPageUrl = "/api", dataDictionaryUrl: dataDictionaryUrl, borderlessTabs: borderlessTabs = false, defaultPageSize: defaultPageSize = 25, dataDictionaryCSV: dataDictionaryCSV = false, dataDictionaryBanner: dataDictionaryBanner = false, disableTableControls: disableTableControls = false, hideDataDictionary: hideDataDictionary = false, customDescription: customDescription, updateAriaLive: updateAriaLive, showRowLimitNotice: showRowLimitNotice = false })=>{
6348
+ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns: customColumns, setDatasetTitle: setDatasetTitle, customMetadataMapping: customMetadataMapping, apiPageUrl: apiPageUrl = "/api", dataDictionaryUrl: dataDictionaryUrl, borderlessTabs: borderlessTabs = false, defaultPageSize: defaultPageSize = 25, dataDictionaryCSV: dataDictionaryCSV = false, dataDictionaryBanner: dataDictionaryBanner = false, disableTableControls: disableTableControls = false, hideDataDictionary: hideDataDictionary = false, customDescription: customDescription, updateAriaLive: updateAriaLive, showRowLimitNotice: showRowLimitNotice = false, useDatasetAPI: useDatasetAPI = false })=>{
6345
6349
  const options = location.search ? {
6346
6350
  ...(0, $hgUW1$qs).parse(location.search, {
6347
6351
  ignoreQueryPrefix: true
@@ -6360,7 +6364,10 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6360
6364
  if (distributions.length) distribution = distributions[0];
6361
6365
  const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
6362
6366
  ...options,
6363
- limit: defaultPageSize
6367
+ limit: defaultPageSize,
6368
+ useDatasetAPI: useDatasetAPI
6369
+ }, {
6370
+ datasetID: id // pass datasetID into additional params to enable dataset API option in useDatastore
6364
6371
  });
6365
6372
  const siteWideDataDictionary = dataDictionaryUrl ? $a0f13962e513caa1$var$getDataDictionary(rootUrl + dataDictionaryUrl).dataDictionary : null;
6366
6373
  // compare schema fields with siteWideDataDictionary to display commonalities for now
@@ -6426,7 +6433,6 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, customColumns
6426
6433
  window.location.hash
6427
6434
  ]);
6428
6435
  const displayDataDictionaryTab = distribution.data && distribution.data.describedBy && distribution.data.describedByType === "application/vnd.tableschema+json" || datasetSitewideDictionary && datasetSitewideDictionary.length > 0;
6429
- const formatType = (0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution);
6430
6436
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
6431
6437
  children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
6432
6438
  content: notFoundContent,