@civicactions/cmsds-open-data-components 4.1.1 → 4.1.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -970,24 +970,6 @@ const $20de4fedf33d4f9a$var$DatasetDate = (props)=>{
970
970
  var $20de4fedf33d4f9a$export$2e2bcd8739ae039 = $20de4fedf33d4f9a$var$DatasetDate;
971
971
 
972
972
 
973
- function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
974
- if (dist && dist.data) {
975
- if (dist.data.format) return dist.data.format.toLowerCase();
976
- if (dist.data.mediaType) {
977
- const mediaType = dist.data.mediaType.split('/');
978
- if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
979
- }
980
- if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
981
- if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
982
- const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
983
- if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
984
- }
985
- }
986
- }
987
- return '';
988
- }
989
-
990
-
991
973
  const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
992
974
  const desktop = (0, $hgUW1$useMediaQuery)({
993
975
  minWidth: 1024
@@ -1031,8 +1013,9 @@ const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
1031
1013
  refresh: refresh
1032
1014
  };
1033
1015
  const url = `/dataset/${identifier}`;
1016
+ const formatType = distribution?.format?.toLowerCase() || distribution?.mediaType?.split('/')?.[1]?.toLowerCase() || '';
1034
1017
  const DataTableLink = ()=>{
1035
- if ((0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv") return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Link), {
1018
+ if (formatType === "csv") return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Link), {
1036
1019
  to: `${url}#data-table`,
1037
1020
  children: [
1038
1021
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $b38839fd67928f42$export$2e2bcd8739ae039), {
@@ -1058,15 +1041,12 @@ const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
1058
1041
  });
1059
1042
  };
1060
1043
  const dataDictionaryExists = ()=>{
1061
- if (distribution && "data" in distribution) {
1062
- if ("describedBy" in distribution.data && "describedByType" in distribution.data) {
1063
- const types = [
1064
- 'application/vnd.tableschema+json',
1065
- 'application/pdf'
1066
- ];
1067
- const isValidType = types.includes(distribution.data.describedByType);
1068
- return isValidType;
1069
- }
1044
+ if (distribution?.describedBy && distribution?.describedByType) {
1045
+ const types = [
1046
+ 'application/vnd.tableschema+json',
1047
+ 'application/pdf'
1048
+ ];
1049
+ return types.includes(distribution.describedByType);
1070
1050
  }
1071
1051
  return false;
1072
1052
  };
@@ -1177,7 +1157,7 @@ const $52c6454cae137465$var$DatasetSearchListItem = (props)=>{
1177
1157
  /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1178
1158
  className: linkContainerClasses,
1179
1159
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
1180
- className: `${linkClasses}${(0, $f764661366bd9e1b$export$ee48b7e0e4eb536e)(distribution) === "csv" ? '' : ' dkan-disabled-link-wrapper'}`,
1160
+ className: `${linkClasses}${formatType === "csv" ? '' : ' dkan-disabled-link-wrapper'}`,
1181
1161
  children: /*#__PURE__*/ (0, $hgUW1$jsx)(DataTableLink, {})
1182
1162
  })
1183
1163
  }),
@@ -1794,7 +1774,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
1794
1774
  largeFile: showLargeFile,
1795
1775
  paginationEnabled: enablePagination,
1796
1776
  dataDictionaryLinks: dataDictionaryLinks,
1797
- distribution: "%Ref:distribution" in item && item["%Ref:distribution"] ? item["%Ref:distribution"][0] : {},
1777
+ distribution: item.distribution?.[0] ?? {},
1798
1778
  ...dateDetailProps,
1799
1779
  ...topicProps
1800
1780
  }, item.identifier);
@@ -6381,6 +6361,23 @@ const $0958733ee130fc44$var$ResourceInformation = ({ distribution: distribution,
6381
6361
  var $0958733ee130fc44$export$2e2bcd8739ae039 = $0958733ee130fc44$var$ResourceInformation;
6382
6362
 
6383
6363
 
6364
+ function $f764661366bd9e1b$export$ee48b7e0e4eb536e(dist) {
6365
+ if (dist && dist.data) {
6366
+ if (dist.data.format) return dist.data.format.toLowerCase();
6367
+ if (dist.data.mediaType) {
6368
+ const mediaType = dist.data.mediaType.split('/');
6369
+ if (mediaType.length && mediaType[1]) return mediaType[1].toLowerCase();
6370
+ }
6371
+ if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
6372
+ if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
6373
+ const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
6374
+ if (mimeType.length && mimeType[1]) return mimeType[1].toLowerCase();
6375
+ }
6376
+ }
6377
+ }
6378
+ return '';
6379
+ }
6380
+
6384
6381
 
6385
6382
 
6386
6383
  const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource: resource, rootUrl: rootUrl, title: title })=>{