@civicactions/cmsds-open-data-components 3.2.1 → 3.2.2

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
@@ -159,6 +159,58 @@ var $f57121650539d8c5$export$2e2bcd8739ae039 = $f57121650539d8c5$var$NavBar;
159
159
 
160
160
 
161
161
 
162
+ class $c49454ea7d1c4579$var$ErrorBoundary extends (0, $hgUW1$react).Component {
163
+ constructor(props){
164
+ super(props);
165
+ this.state = {
166
+ hasError: false,
167
+ error: undefined
168
+ };
169
+ }
170
+ static getDerivedStateFromError(error) {
171
+ // Update state so the next render will show the fallback UI.
172
+ return {
173
+ hasError: true,
174
+ error: error
175
+ };
176
+ }
177
+ componentDidCatch(error, info) {
178
+ // TODO report to logging solution
179
+ console.error({
180
+ error: error,
181
+ info: info
182
+ });
183
+ }
184
+ render() {
185
+ if (this.props.component) {
186
+ if (this.state.hasError) return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
187
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
188
+ children: "We're sorry, the site has encountered an unexpected error."
189
+ })
190
+ });
191
+ return this.props.children;
192
+ }
193
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
194
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
195
+ className: "ds-l-container",
196
+ children: [
197
+ /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
198
+ className: "ds-text-heading--2xl",
199
+ children: "Error"
200
+ }),
201
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
202
+ children: "We're sorry, the site has encountered an unexpected error."
203
+ })
204
+ ]
205
+ })
206
+ });
207
+ }
208
+ }
209
+ var $c49454ea7d1c4579$export$2e2bcd8739ae039 = $c49454ea7d1c4579$var$ErrorBoundary;
210
+
211
+
212
+
213
+
162
214
 
163
215
 
164
216
 
@@ -1844,6 +1896,10 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ data: data, columns: columns, setSort
1844
1896
  "aria-live": "assertive",
1845
1897
  "aria-atomic": "true",
1846
1898
  children: ariaLiveFeedback
1899
+ }),
1900
+ !loading && table.getRowModel().rows.length === 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
1901
+ variation: "warn",
1902
+ children: "No results found for the current filters"
1847
1903
  })
1848
1904
  ]
1849
1905
  });
@@ -2052,11 +2108,11 @@ var $2ed0091f7e32d1e6$export$2e2bcd8739ae039 = $2ed0091f7e32d1e6$var$DataTablePa
2052
2108
 
2053
2109
 
2054
2110
 
2055
- const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL: downloadURL, jsonUrl: jsonUrl })=>{
2056
- const { limit: limit, offset: offset, count: count } = resource;
2111
+ const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL: downloadURL, unfilteredDownloadURL: unfilteredDownloadURL, jsonUrl: jsonUrl })=>{
2112
+ const { limit: limit, offset: offset, count: count, conditions: conditions } = resource;
2057
2113
  const intCount = count ? count : 0;
2058
2114
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2059
- className: "ds-l-row ds-u-align-items--center ds-u-margin-bottom--2",
2115
+ className: "ds-l-row ds-u-align-items--center",
2060
2116
  children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2061
2117
  className: "ds-l-col--12 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--between ds-u-align-items--center",
2062
2118
  children: [
@@ -2069,11 +2125,11 @@ const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL
2069
2125
  })
2070
2126
  }),
2071
2127
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2072
- className: "dc-c-resource-header--buttons ds-l-col--12 ds-l-lg-col--8 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-margin-bottom--2 ds-u-md-margin-bottom--0 ds-u-padding-x--0",
2128
+ className: "dc-c-resource-header--buttons ds-l-col--12 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-padding-x--0",
2073
2129
  children: [
2074
2130
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2075
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-bottom--2 ds-u-md-margin-bottom--0",
2076
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
2131
+ className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-bottom--2",
2132
+ children: conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
2077
2133
  onOpen: ()=>{
2078
2134
  navigator.clipboard.writeText(window.location.href);
2079
2135
  },
@@ -2082,6 +2138,7 @@ const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL
2082
2138
  dialog: true,
2083
2139
  ariaLabel: "Copy link to filtered data",
2084
2140
  title: "Link copied to clipboard",
2141
+ "aria-disabled": conditions.length === 0,
2085
2142
  children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2086
2143
  className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2087
2144
  children: [
@@ -2091,24 +2148,59 @@ const $6380a4a580b24362$var$DataTableHeader = ({ resource: resource, downloadURL
2091
2148
  " Copy link to filtered data"
2092
2149
  ]
2093
2150
  })
2094
- })
2095
- }),
2096
- /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2097
- className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2",
2098
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2099
- 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",
2100
- href: downloadURL,
2151
+ }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2152
+ "aria-disabled": true,
2153
+ "aria-label": "Copy link to filtered data",
2154
+ className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
2101
2155
  children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2102
2156
  className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2103
2157
  children: [
2104
2158
  /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2105
- className: "fas fa-file-csv"
2159
+ className: "fas fa-copy"
2106
2160
  }),
2107
- " Download filtered data (CSV)"
2161
+ " Copy link to filtered data"
2108
2162
  ]
2109
2163
  })
2110
2164
  })
2111
2165
  }),
2166
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2167
+ 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",
2168
+ children: [
2169
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2170
+ 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",
2171
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2172
+ 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",
2173
+ href: downloadURL,
2174
+ "aria-disabled": conditions.length === 0,
2175
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2176
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2177
+ children: [
2178
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2179
+ className: "fas fa-file-csv"
2180
+ }),
2181
+ " Download filtered data (CSV)"
2182
+ ]
2183
+ })
2184
+ })
2185
+ }),
2186
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2187
+ 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",
2188
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2189
+ 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",
2190
+ href: unfilteredDownloadURL,
2191
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
2192
+ className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
2193
+ children: [
2194
+ /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2195
+ className: "fas fa-file-csv"
2196
+ }),
2197
+ " Download full dataset (CSV)"
2198
+ ]
2199
+ })
2200
+ })
2201
+ })
2202
+ ]
2203
+ }),
2112
2204
  jsonUrl && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
2113
2205
  className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-margin-left--2 ds-u-margin-top--2 ds-u-sm-margin-top--0",
2114
2206
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
@@ -2408,7 +2500,7 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = (props)=>{
2408
2500
  ]);
2409
2501
  };
2410
2502
  (0, $hgUW1$react).useEffect(()=>{
2411
- if (conditions.length) addCondition(conditions);
2503
+ if (conditions && conditions.length) addCondition(conditions);
2412
2504
  else addCondition(null);
2413
2505
  setTitleConditions(conditions);
2414
2506
  }, []);
@@ -2574,6 +2666,7 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ id: id, distribution: distribution
2574
2666
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6380a4a580b24362$export$2e2bcd8739ae039), {
2575
2667
  resource: resource,
2576
2668
  downloadURL: downloadURL,
2669
+ unfilteredDownloadURL: distribution.data.downloadURL,
2577
2670
  jsonUrl: jsonUrl
2578
2671
  }),
2579
2672
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
@@ -3136,6 +3229,10 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
3136
3229
  "aria-live": "assertive",
3137
3230
  "aria-atomic": "true",
3138
3231
  children: ariaLiveFeedback
3232
+ }),
3233
+ table.getRowModel().rows.length === 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3234
+ variation: "warn",
3235
+ children: "No results found for the current filters"
3139
3236
  })
3140
3237
  ]
3141
3238
  }),
@@ -5964,5 +6061,5 @@ var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollTo
5964
6061
 
5965
6062
 
5966
6063
 
5967
- 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, $1a2bf34e2a8f6b80$export$59a943b34a82e690 as truncateText};
6064
+ export {$f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $c49454ea7d1c4579$export$2e2bcd8739ae039 as ErrorBoundary, $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, $1a2bf34e2a8f6b80$export$59a943b34a82e690 as truncateText};
5968
6065
  //# sourceMappingURL=main.js.map