@civicactions/cmsds-open-data-components 4.0.14 → 4.0.15
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 +11 -13
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1419,9 +1419,9 @@ async function $eff7d34c30f5a0fc$export$2d2256cb46e92ff7(rootUrl, options, ACA)
|
|
|
1419
1419
|
|
|
1420
1420
|
|
|
1421
1421
|
const $e873081a6e8f024e$export$1040147c129fdde9 = (query)=>{
|
|
1422
|
-
// Only allow letters, numbers, and
|
|
1422
|
+
// Only allow letters, numbers, spaces, and empty string
|
|
1423
1423
|
// A search containing any special character will be rejected
|
|
1424
|
-
return /^[a-zA-Z0-9 ]
|
|
1424
|
+
return /^[a-zA-Z0-9 ]*$/.test(query.trim());
|
|
1425
1425
|
};
|
|
1426
1426
|
const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
1427
1427
|
const { rootUrl: rootUrl, enableSort: enableSort = true, enablePagination: enablePagination = true, defaultPageSize: defaultPageSize = 10, defaultSort: defaultSort = {
|
|
@@ -1841,16 +1841,14 @@ const $fea9297ba4dd394c$var$HeaderSearch = (props)=>{
|
|
|
1841
1841
|
function searchForDataset(e) {
|
|
1842
1842
|
e.preventDefault();
|
|
1843
1843
|
if (window) {
|
|
1844
|
-
if (modalSearchTerm) {
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
} else setInvalidSearch(true);
|
|
1853
|
-
}
|
|
1844
|
+
if ((0, $e873081a6e8f024e$export$1040147c129fdde9)(modalSearchTerm)) {
|
|
1845
|
+
setInvalidSearch(false);
|
|
1846
|
+
if (window.location.pathname !== '/datasets') navigate(`/datasets?fulltext=${modalSearchTerm}`);
|
|
1847
|
+
else {
|
|
1848
|
+
window.location.search = `fulltext=${modalSearchTerm}`;
|
|
1849
|
+
setModalSearch(false);
|
|
1850
|
+
}
|
|
1851
|
+
} else setInvalidSearch(true);
|
|
1854
1852
|
}
|
|
1855
1853
|
}
|
|
1856
1854
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
@@ -2205,7 +2203,7 @@ const $59a079354baa335c$var$Hero = ({ title: title, description: description, se
|
|
|
2205
2203
|
const [invalidSearch, setInvalidSearch] = (0, $hgUW1$useState)(false);
|
|
2206
2204
|
function submitHero(e) {
|
|
2207
2205
|
e.preventDefault();
|
|
2208
|
-
if (
|
|
2206
|
+
if ((0, $e873081a6e8f024e$export$1040147c129fdde9)(searchValue)) {
|
|
2209
2207
|
setInvalidSearch(false);
|
|
2210
2208
|
navigate(`/${searchUrl}?${searchKey}=${searchValue}`);
|
|
2211
2209
|
} else setInvalidSearch(true);
|