synapse-react-client 4.0.1 → 4.0.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/SWC.index.js +1 -1
- package/dist/components/EntityDownloadButton/EntityDownloadButton.d.ts +3 -0
- package/dist/components/EntityDownloadButton/EntityDownloadButton.d.ts.map +1 -1
- package/dist/components/EntityDownloadButton/EntityDownloadButton.js +112 -118
- package/dist/components/EntityDownloadButton/EntityDownloadButton.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageChatSearch.d.ts.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageChatSearch.js +30 -32
- package/dist/components/SynapseHomepageV2/SynapseHomepageChatSearch.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageSearch.d.ts.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseHomepageSearch.js +27 -30
- package/dist/components/SynapseHomepageV2/SynapseHomepageSearch.js.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseSearchChips.d.ts.map +1 -1
- package/dist/components/SynapseHomepageV2/SynapseSearchChips.js +14 -17
- package/dist/components/SynapseHomepageV2/SynapseSearchChips.js.map +1 -1
- package/dist/components/SynapseNavDrawer/SynapseNavDrawer.d.ts.map +1 -1
- package/dist/components/SynapseNavDrawer/SynapseNavDrawer.js +90 -91
- package/dist/components/SynapseNavDrawer/SynapseNavDrawer.js.map +1 -1
- package/dist/components/SynapseSearchPageResults/SynapseSearchResultsCard.d.ts.map +1 -1
- package/dist/components/SynapseSearchPageResults/SynapseSearchResultsCard.js +66 -64
- package/dist/components/SynapseSearchPageResults/SynapseSearchResultsCard.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -1,49 +1,47 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useTheme as
|
|
1
|
+
import { jsx as t, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme as y, Box as g, FormControl as C, OutlinedInput as V, InputAdornment as v, Select as I, MenuItem as u } from "@mui/material";
|
|
3
3
|
import { useState as a } from "react";
|
|
4
|
-
import { getSearchToken as
|
|
4
|
+
import { getSearchToken as b } from "../SynapseNavDrawer/SynapseNavDrawer.js";
|
|
5
5
|
import { parseSynId as $ } from "../../utils/functions/RegularExpressions.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function j({
|
|
9
|
-
gotoPlace: n
|
|
6
|
+
function M({
|
|
7
|
+
gotoPlace: o
|
|
10
8
|
}) {
|
|
11
|
-
const c =
|
|
9
|
+
const c = y(), [s, p] = a(""), [i, h] = a(""), [n, m] = a(
|
|
12
10
|
0
|
|
13
11
|
/* SEARCH */
|
|
14
|
-
),
|
|
15
|
-
if (
|
|
16
|
-
const e = s.toLowerCase().trim(),
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
|
|
12
|
+
), l = () => {
|
|
13
|
+
if (n == 0) {
|
|
14
|
+
const e = s.toLowerCase().trim(), r = $(e);
|
|
15
|
+
if (r && r.targetVersionNumber) {
|
|
16
|
+
const x = `${r.targetId}.${r.targetVersionNumber}`;
|
|
17
|
+
o(`/Synapse:${x}`);
|
|
20
18
|
return;
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
o(
|
|
21
|
+
`/SearchV2:default?query=${b(
|
|
24
22
|
e.split(/[ ,]+/)
|
|
25
|
-
)}`
|
|
23
|
+
)}`
|
|
26
24
|
);
|
|
27
25
|
} else
|
|
28
|
-
|
|
29
|
-
},
|
|
26
|
+
o(`/Chat:initialMessage=${encodeURIComponent(i)}`);
|
|
27
|
+
}, d = (e) => {
|
|
30
28
|
e.preventDefault(), l();
|
|
31
|
-
},
|
|
29
|
+
}, f = (e) => {
|
|
32
30
|
e.key === "Enter" && (e.preventDefault(), l());
|
|
33
31
|
};
|
|
34
|
-
return /* @__PURE__ */ t(
|
|
35
|
-
|
|
32
|
+
return /* @__PURE__ */ t(g, { component: "form", onSubmit: d, children: /* @__PURE__ */ t(C, { fullWidth: !0, sx: { m: 1 }, children: /* @__PURE__ */ t(
|
|
33
|
+
V,
|
|
36
34
|
{
|
|
37
|
-
value:
|
|
35
|
+
value: n == 0 ? s : i,
|
|
38
36
|
startAdornment: /* @__PURE__ */ t(
|
|
39
|
-
|
|
37
|
+
v,
|
|
40
38
|
{
|
|
41
39
|
position: "start",
|
|
42
40
|
sx: { p: "0px", ml: "7px", mr: "13px" },
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
-
|
|
41
|
+
children: /* @__PURE__ */ S(
|
|
42
|
+
I,
|
|
45
43
|
{
|
|
46
|
-
value:
|
|
44
|
+
value: n,
|
|
47
45
|
sx: {
|
|
48
46
|
fontSize: "24px",
|
|
49
47
|
fontWeight: 400,
|
|
@@ -54,7 +52,7 @@ function j({
|
|
|
54
52
|
}
|
|
55
53
|
},
|
|
56
54
|
onChange: (e) => {
|
|
57
|
-
|
|
55
|
+
m(e.target.value);
|
|
58
56
|
},
|
|
59
57
|
children: [
|
|
60
58
|
/* @__PURE__ */ t(u, { value: 0, children: "Search" }),
|
|
@@ -64,16 +62,16 @@ function j({
|
|
|
64
62
|
)
|
|
65
63
|
}
|
|
66
64
|
),
|
|
67
|
-
placeholder:
|
|
65
|
+
placeholder: n == 0 ? "Search Synapse" : "Ask a question",
|
|
68
66
|
sx: { fontSize: "24px", borderRadius: 96.6 },
|
|
69
67
|
onChange: (e) => {
|
|
70
|
-
|
|
68
|
+
n == 0 ? p(e.target.value) : h(e.target.value);
|
|
71
69
|
},
|
|
72
|
-
onKeyDown:
|
|
70
|
+
onKeyDown: f
|
|
73
71
|
}
|
|
74
72
|
) }) });
|
|
75
73
|
}
|
|
76
74
|
export {
|
|
77
|
-
|
|
75
|
+
M as SynapseHomepageChatSearch
|
|
78
76
|
};
|
|
79
77
|
//# sourceMappingURL=SynapseHomepageChatSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseHomepageChatSearch.js","sources":["../../../src/components/SynapseHomepageV2/SynapseHomepageChatSearch.tsx"],"sourcesContent":["import {\n Box,\n FormControl,\n InputAdornment,\n MenuItem,\n OutlinedInput,\n Select,\n useTheme,\n} from '@mui/material'\nimport { Color } from '@mui/material/styles'\nimport { FormEventHandler, KeyboardEventHandler, useState } from 'react'\nimport { getSearchToken } from '../SynapseNavDrawer/SynapseNavDrawer'\nimport { parseSynId } from '@/utils/functions/RegularExpressions'\
|
|
1
|
+
{"version":3,"file":"SynapseHomepageChatSearch.js","sources":["../../../src/components/SynapseHomepageV2/SynapseHomepageChatSearch.tsx"],"sourcesContent":["import {\n Box,\n FormControl,\n InputAdornment,\n MenuItem,\n OutlinedInput,\n Select,\n useTheme,\n} from '@mui/material'\nimport { Color } from '@mui/material/styles'\nimport { FormEventHandler, KeyboardEventHandler, useState } from 'react'\nimport { getSearchToken } from '../SynapseNavDrawer/SynapseNavDrawer'\nimport { parseSynId } from '@/utils/functions/RegularExpressions'\n\nexport type SynapseHomepageChatSearchProps = {\n gotoPlace: (href: string) => void\n}\nenum SearchMode {\n SEARCH = 0,\n CHAT = 1,\n}\n\n/**\n * Synapse Homepage Search component with a dropdown \"autocomplete\" menu of options.\n * SWC-7005: Not used in the current implementation of the Home Page, but there are plans to utilize it later.\n * @returns\n */\nexport function SynapseHomepageChatSearch({\n gotoPlace,\n}: SynapseHomepageChatSearchProps) {\n const theme = useTheme()\n const [searchValue, setSearchValue] = useState('')\n const [chatValue, setChatValue] = useState('')\n const [mode, setMode] = useState(SearchMode.SEARCH)\n\n const executeSearch = () => {\n if (mode == SearchMode.SEARCH) {\n const searchValueCleaned = searchValue.toLowerCase().trim()\n\n // Check if the input is a valid Synapse ID with version\n const parsedSynId = parseSynId(searchValueCleaned)\n if (parsedSynId && parsedSynId.targetVersionNumber) {\n const synIdWithVersion = `${parsedSynId.targetId}.${parsedSynId.targetVersionNumber}`\n gotoPlace(`/Synapse:${synIdWithVersion}`)\n return\n }\n gotoPlace(\n `/SearchV2:default?query=${getSearchToken(\n searchValueCleaned.split(/[ ,]+/),\n )}`,\n )\n } else {\n gotoPlace(`/Chat:initialMessage=${encodeURIComponent(chatValue)}`)\n }\n }\n const handleSubmit: FormEventHandler<HTMLFormElement> = event => {\n event.preventDefault()\n executeSearch()\n }\n const handleKeyDown: KeyboardEventHandler<\n HTMLTextAreaElement | HTMLInputElement\n > = event => {\n if (event.key === 'Enter') {\n event.preventDefault()\n executeSearch()\n }\n }\n\n return (\n <Box component=\"form\" onSubmit={handleSubmit}>\n <FormControl fullWidth sx={{ m: 1 }}>\n <OutlinedInput\n value={mode == SearchMode.SEARCH ? searchValue : chatValue}\n startAdornment={\n <InputAdornment\n position=\"start\"\n sx={{ p: '0px', ml: '7px', mr: '13px' }}\n >\n <Select\n value={mode}\n sx={{\n fontSize: '24px',\n fontWeight: 400,\n minWidth: '125px',\n color: (theme.palette.secondary as unknown as Color)[600],\n '& div[role=\"combobox\"]': {\n p: '14px 12px',\n },\n }}\n onChange={v => {\n setMode(v.target.value as SearchMode)\n //restore search or chat value\n }}\n >\n <MenuItem value={SearchMode.SEARCH}>Search</MenuItem>\n <MenuItem value={SearchMode.CHAT}>Chat</MenuItem>\n </Select>\n </InputAdornment>\n }\n placeholder={\n mode == SearchMode.SEARCH ? 'Search Synapse' : 'Ask a question'\n }\n sx={{ fontSize: '24px', borderRadius: 96.6 }}\n onChange={event => {\n if (mode == SearchMode.SEARCH) {\n setSearchValue(event.target.value)\n } else {\n setChatValue(event.target.value)\n }\n }}\n onKeyDown={handleKeyDown}\n />\n </FormControl>\n </Box>\n )\n}\n"],"names":["SynapseHomepageChatSearch","gotoPlace","theme","useTheme","searchValue","setSearchValue","useState","chatValue","setChatValue","mode","setMode","executeSearch","searchValueCleaned","parsedSynId","parseSynId","synIdWithVersion","getSearchToken","handleSubmit","event","handleKeyDown","jsx","Box","FormControl","OutlinedInput","InputAdornment","jsxs","Select","v","MenuItem"],"mappings":";;;;;AA2BO,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AAAA,YAAA;AAAA,cACC,OAAOjB;AAAA,cACP,IAAI;AAAA,gBACF,UAAU;AAAA,gBACV,YAAY;AAAA,gBACZ,UAAU;AAAA,gBACV,OAAQP,EAAM,QAAQ,UAA+B,GAAG;AAAA,gBACxD,0BAA0B;AAAA,kBACxB,GAAG;AAAA,gBAAA;AAAA,cACL;AAAA,cAEF,UAAU,CAAAyB,MAAK;AACb,gBAAAjB,EAAQiB,EAAE,OAAO,KAAmB;AAAA,cAEtC;AAAA,cAEA,UAAA;AAAA,gBAAA,gBAAAP,EAACQ,GAAA,EAAS,OAAO,GAAmB,UAAA,UAAM;AAAA,gBAC1C,gBAAAR,EAACQ,GAAA,EAAS,OAAO,GAAiB,UAAA,OAAA,CAAI;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACxC;AAAA,MAAA;AAAA,MAGJ,aACEnB,KAAQ,IAAoB,mBAAmB;AAAA,MAEjD,IAAI,EAAE,UAAU,QAAQ,cAAc,KAAA;AAAA,MACtC,UAAU,CAAAS,MAAS;AACjB,QAAIT,KAAQ,IACVJ,EAAea,EAAM,OAAO,KAAK,IAEjCV,EAAaU,EAAM,OAAO,KAAK;AAAA,MAEnC;AAAA,MACA,WAAWC;AAAA,IAAA;AAAA,EAAA,GAEf,EAAA,CACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseHomepageSearch.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseHomepageV2/SynapseHomepageSearch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SynapseHomepageSearch.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseHomepageV2/SynapseHomepageSearch.tsx"],"names":[],"mappings":"AAmBA,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAuBD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,SAAS,GACV,EAAE,0BAA0B,2CAkF5B"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Search as
|
|
2
|
+
import { Search as c } from "../../assets/themed_icons/Search.js";
|
|
3
3
|
import "@mui/material/SvgIcon";
|
|
4
4
|
import "../../synapse-client/SynapseClient.js";
|
|
5
5
|
import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode";
|
|
6
6
|
import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse";
|
|
7
7
|
import "@sage-bionetworks/synapse-client/util/SynapseClientError";
|
|
8
|
-
import
|
|
8
|
+
import "@sage-bionetworks/synapse-types";
|
|
9
9
|
import "../../utils/functions/EntityTypeUtils.js";
|
|
10
|
-
import { BUNDLE_MASK_QUERY_RESULTS as
|
|
10
|
+
import { BUNDLE_MASK_QUERY_RESULTS as f } from "../../utils/SynapseConstants.js";
|
|
11
11
|
import "lodash-es";
|
|
12
12
|
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
|
|
13
13
|
import "@tanstack/react-query";
|
|
14
14
|
import "../../utils/PermissionLevelToAccessType.js";
|
|
15
|
-
import { useState as
|
|
15
|
+
import { useState as h } from "react";
|
|
16
16
|
import "../../utils/context/SynapseContext.js";
|
|
17
17
|
import "use-deep-compare-effect";
|
|
18
|
-
import { styled as
|
|
18
|
+
import { styled as y, Popper as S, useTheme as R, FormControl as b, Autocomplete as g, TextField as q, InputAdornment as C, Box as I } from "@mui/material";
|
|
19
19
|
import "../../utils/hooks/useCookiePreferences.js";
|
|
20
20
|
import "../../utils/hooks/useSourceAppConfigs.js";
|
|
21
21
|
import "universal-cookie";
|
|
@@ -30,57 +30,54 @@ import "lodash-es/xorWith";
|
|
|
30
30
|
import "react-router";
|
|
31
31
|
import "@sage-bionetworks/synapse-client";
|
|
32
32
|
import "../../utils/types/IsType.js";
|
|
33
|
-
import { useGetQueryResultBundleWithAsyncStatus as
|
|
34
|
-
|
|
35
|
-
const n = "0px 4px 4px 0px rgba(0, 0, 0, 0.05), 0px 1px 1px 0px rgba(0, 0, 0, 0.05)", M = R(b)(() => ({
|
|
33
|
+
import { useGetQueryResultBundleWithAsyncStatus as A } from "../../synapse-queries/entity/useGetQueryResultBundle.js";
|
|
34
|
+
const i = "0px 4px 4px 0px rgba(0, 0, 0, 0.05), 0px 1px 1px 0px rgba(0, 0, 0, 0.05)", B = y(S)(() => ({
|
|
36
35
|
"& .MuiAutocomplete-paper": {
|
|
37
36
|
borderRadius: "0px 0px 40px 40px",
|
|
38
37
|
p: "0px 20px 20px 20px",
|
|
39
|
-
boxShadow:
|
|
38
|
+
boxShadow: i
|
|
40
39
|
}
|
|
41
40
|
})), P = (t) => /* @__PURE__ */ o(
|
|
42
|
-
|
|
41
|
+
B,
|
|
43
42
|
{
|
|
44
43
|
...t,
|
|
45
44
|
placement: "bottom",
|
|
46
45
|
modifiers: [{ name: "flip", enabled: !1 }]
|
|
47
46
|
}
|
|
48
47
|
);
|
|
49
|
-
function
|
|
48
|
+
function ae({
|
|
50
49
|
sourceTable: t,
|
|
51
|
-
gotoPlace:
|
|
50
|
+
gotoPlace: n
|
|
52
51
|
}) {
|
|
53
|
-
const [m,
|
|
54
|
-
partMask:
|
|
52
|
+
const [m, p] = h(!1), a = R(), l = {
|
|
53
|
+
partMask: f,
|
|
55
54
|
concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest",
|
|
56
55
|
entityId: t,
|
|
57
56
|
query: {
|
|
58
57
|
sql: `SELECT * FROM ${t}`,
|
|
59
58
|
limit: 10
|
|
60
59
|
}
|
|
61
|
-
}, { data:
|
|
60
|
+
}, { data: d, isLoading: u } = A(l), r = d?.responseBody?.queryResult?.queryResults, x = r?.headers?.findIndex(
|
|
62
61
|
(e) => e.name == "top_searched"
|
|
63
62
|
);
|
|
64
|
-
return /* @__PURE__ */ o(
|
|
65
|
-
|
|
63
|
+
return /* @__PURE__ */ o(b, { fullWidth: !0, sx: { m: 1 }, children: /* @__PURE__ */ o(
|
|
64
|
+
g,
|
|
66
65
|
{
|
|
67
66
|
freeSolo: !0,
|
|
68
67
|
disableClearable: !0,
|
|
69
68
|
filterOptions: (e) => e,
|
|
70
|
-
options: r && !
|
|
71
|
-
onChange: (e,
|
|
72
|
-
|
|
73
|
-
l ? `/SearchV2:default?query=${encodeURIComponent(p)}` : `/Search:${encodeURIComponent(p)}`
|
|
74
|
-
);
|
|
69
|
+
options: r && !u ? r.rows.map((e) => e.values[x] ?? "") : ["..."],
|
|
70
|
+
onChange: (e, s) => {
|
|
71
|
+
s && n(`/SearchV2:default?query=${encodeURIComponent(s)}`);
|
|
75
72
|
},
|
|
76
73
|
slots: {
|
|
77
74
|
popper: P
|
|
78
75
|
},
|
|
79
|
-
onOpen: () =>
|
|
80
|
-
onClose: () =>
|
|
76
|
+
onOpen: () => p(!0),
|
|
77
|
+
onClose: () => p(!1),
|
|
81
78
|
groupBy: () => "Most popular searches",
|
|
82
79
|
renderInput: (e) => /* @__PURE__ */ o(
|
|
83
|
-
|
|
80
|
+
q,
|
|
84
81
|
{
|
|
85
82
|
...e,
|
|
86
83
|
variant: "outlined",
|
|
@@ -91,10 +88,10 @@ function ce({
|
|
|
91
88
|
fontSize: "24px",
|
|
92
89
|
borderRadius: m ? "40px 40px 0px 0px" : "40px",
|
|
93
90
|
backgroundColor: "white",
|
|
94
|
-
boxShadow:
|
|
91
|
+
boxShadow: i
|
|
95
92
|
},
|
|
96
|
-
startAdornment: /* @__PURE__ */ o(
|
|
97
|
-
|
|
93
|
+
startAdornment: /* @__PURE__ */ o(C, { position: "start", children: /* @__PURE__ */ o(
|
|
94
|
+
I,
|
|
98
95
|
{
|
|
99
96
|
sx: {
|
|
100
97
|
ml: "15px",
|
|
@@ -102,7 +99,7 @@ function ce({
|
|
|
102
99
|
alignItems: "center"
|
|
103
100
|
},
|
|
104
101
|
children: /* @__PURE__ */ o(
|
|
105
|
-
|
|
102
|
+
c,
|
|
106
103
|
{
|
|
107
104
|
size: 32,
|
|
108
105
|
fill: a.palette.secondary[600]
|
|
@@ -118,6 +115,6 @@ function ce({
|
|
|
118
115
|
) });
|
|
119
116
|
}
|
|
120
117
|
export {
|
|
121
|
-
|
|
118
|
+
ae as SynapseHomepageSearch
|
|
122
119
|
};
|
|
123
120
|
//# sourceMappingURL=SynapseHomepageSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseHomepageSearch.js","sources":["../../../src/components/SynapseHomepageV2/SynapseHomepageSearch.tsx"],"sourcesContent":["import React from 'react'\nimport { Search } from '@/assets/themed_icons'\nimport { useGetQueryResultBundleWithAsyncStatus } from '@/synapse-queries'\nimport {
|
|
1
|
+
{"version":3,"file":"SynapseHomepageSearch.js","sources":["../../../src/components/SynapseHomepageV2/SynapseHomepageSearch.tsx"],"sourcesContent":["import React from 'react'\nimport { Search } from '@/assets/themed_icons'\nimport { useGetQueryResultBundleWithAsyncStatus } from '@/synapse-queries'\nimport { SynapseConstants } from '@/utils'\nimport {\n Autocomplete,\n Box,\n Color,\n FormControl,\n InputAdornment,\n Popper,\n PopperProps,\n styled,\n TextField,\n useTheme,\n} from '@mui/material'\nimport { QueryBundleRequest } from '@sage-bionetworks/synapse-types'\nimport { useState } from 'react'\n\nexport type SynapseHomepageSearchProps = {\n sourceTable: string\n gotoPlace: (href: string) => void\n}\n\nconst boxShadow =\n '0px 4px 4px 0px rgba(0, 0, 0, 0.05), 0px 1px 1px 0px rgba(0, 0, 0, 0.05)'\nconst StyledPopper = styled(Popper)(() => ({\n '& .MuiAutocomplete-paper': {\n borderRadius: '0px 0px 40px 40px',\n p: '0px 20px 20px 20px',\n boxShadow,\n },\n}))\n\nconst PopperAlwaysPlacedBelow = (props: PopperProps): React.ReactNode => {\n // Modifier necessary to force placement to remain on the bottom of the anchor element, despite not having enough space to render\n return (\n <StyledPopper\n {...props}\n placement=\"bottom\"\n modifiers={[{ name: 'flip', enabled: false }]}\n />\n )\n}\n\n/**\n * Synapse Homepage Search component with a dropdown \"autocomplete\" menu of options.\n * SWC-7005: Not used in the current implementation of the Home Page, but there are plans to utilize it later.\n * @returns\n */\nexport function SynapseHomepageSearch({\n sourceTable,\n gotoPlace,\n}: SynapseHomepageSearchProps) {\n const [isPopperOpen, setIsPopperOpen] = useState(false)\n const theme = useTheme()\n const partMask = SynapseConstants.BUNDLE_MASK_QUERY_RESULTS\n const request: QueryBundleRequest = {\n partMask,\n concreteType: 'org.sagebionetworks.repo.model.table.QueryBundleRequest',\n entityId: sourceTable,\n query: {\n sql: `SELECT * FROM ${sourceTable}`,\n limit: 10,\n },\n }\n const { data: queryResultResponse, isLoading } =\n useGetQueryResultBundleWithAsyncStatus(request)\n\n const rowSet = queryResultResponse?.responseBody?.queryResult?.queryResults\n const headers = rowSet?.headers\n const topSearchedColIndex = headers?.findIndex(\n selectColumn => selectColumn.name == 'top_searched',\n )!\n return (\n <FormControl fullWidth sx={{ m: 1 }}>\n <Autocomplete\n freeSolo\n disableClearable\n // disable filtering\n filterOptions={options => options}\n options={\n rowSet && !isLoading\n ? rowSet.rows.map(row => row.values[topSearchedColIndex] ?? '')\n : ['...']\n }\n onChange={(_event, newValue: string | null) => {\n if (newValue) {\n gotoPlace(`/SearchV2:default?query=${encodeURIComponent(newValue)}`)\n }\n }}\n slots={{\n popper: PopperAlwaysPlacedBelow,\n }}\n onOpen={() => setIsPopperOpen(true)}\n onClose={() => setIsPopperOpen(false)}\n groupBy={() => 'Most popular searches'}\n renderInput={params => (\n <TextField\n {...params}\n variant=\"outlined\"\n placeholder=\"Search Synapse\"\n slotProps={{\n input: {\n sx: {\n fontSize: '24px',\n borderRadius: isPopperOpen ? '40px 40px 0px 0px' : '40px',\n backgroundColor: 'white',\n boxShadow,\n },\n startAdornment: (\n <InputAdornment position=\"start\">\n <Box\n sx={{\n ml: '15px',\n display: 'flex',\n alignItems: 'center',\n }}\n >\n <Search\n size={32}\n fill={\n (theme.palette.secondary as unknown as Color)[600]\n }\n />\n </Box>\n </InputAdornment>\n ),\n },\n }}\n />\n )}\n />\n </FormControl>\n )\n}\n"],"names":["boxShadow","StyledPopper","styled","Popper","PopperAlwaysPlacedBelow","props","jsx","SynapseHomepageSearch","sourceTable","gotoPlace","isPopperOpen","setIsPopperOpen","useState","theme","useTheme","request","SynapseConstants.BUNDLE_MASK_QUERY_RESULTS","queryResultResponse","isLoading","useGetQueryResultBundleWithAsyncStatus","rowSet","topSearchedColIndex","selectColumn","FormControl","Autocomplete","options","row","_event","newValue","params","TextField","InputAdornment","Box","Search"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAMA,IACJ,4EACIC,IAAeC,EAAOC,CAAM,EAAE,OAAO;AAAA,EACzC,4BAA4B;AAAA,IAC1B,cAAc;AAAA,IACd,GAAG;AAAA,IACH,WAAAH;AAAA,EAAA;AAEJ,EAAE,GAEII,IAA0B,CAACC,MAG7B,gBAAAC;AAAA,EAACL;AAAA,EAAA;AAAA,IACE,GAAGI;AAAA,IACJ,WAAU;AAAA,IACV,WAAW,CAAC,EAAE,MAAM,QAAQ,SAAS,IAAO;AAAA,EAAA;AAAA;AAU3C,SAASE,GAAsB;AAAA,EACpC,aAAAC;AAAA,EACA,WAAAC;AACF,GAA+B;AAC7B,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAS,EAAK,GAChDC,IAAQC,EAAA,GAERC,IAA8B;AAAA,IAClC,UAFeC;AAAAA,IAGf,cAAc;AAAA,IACd,UAAUR;AAAA,IACV,OAAO;AAAA,MACL,KAAK,iBAAiBA,CAAW;AAAA,MACjC,OAAO;AAAA,IAAA;AAAA,EACT,GAEI,EAAE,MAAMS,GAAqB,WAAAC,EAAA,IACjCC,EAAuCJ,CAAO,GAE1CK,IAASH,GAAqB,cAAc,aAAa,cAEzDI,IADUD,GAAQ,SACa;AAAA,IACnC,CAAAE,MAAgBA,EAAa,QAAQ;AAAA,EAAA;AAEvC,SACE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UAEJ;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA,GAGN;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseSearchChips.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseHomepageV2/SynapseSearchChips.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SynapseSearchChips.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseHomepageV2/SynapseSearchChips.tsx"],"names":[],"mappings":"AAqBA,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,EAAE,uBAAuB,2CA8CxE"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
2
|
-
import { Chip as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { DEFAULT_SEARCH_QUERY as d } from "../../utils/searchDefaults.js";
|
|
6
|
-
const p = [
|
|
1
|
+
import { jsx as r, Fragment as a } from "react/jsx-runtime";
|
|
2
|
+
import { Chip as t, Typography as i } from "@mui/material";
|
|
3
|
+
import { DEFAULT_SEARCH_QUERY as s } from "../../utils/searchDefaults.js";
|
|
4
|
+
const c = [
|
|
7
5
|
"Alzheimer's Disease",
|
|
8
6
|
"Neurofibromatosis mouse models",
|
|
9
7
|
"Cancer",
|
|
@@ -12,18 +10,17 @@ const p = [
|
|
|
12
10
|
"ROSMAP Religious Orders Study and Memory and Aging Project",
|
|
13
11
|
"Retinal regeneration studies",
|
|
14
12
|
"Machine Learning datasets"
|
|
15
|
-
],
|
|
13
|
+
], l = {
|
|
16
14
|
key: "node_type",
|
|
17
15
|
value: "project",
|
|
18
16
|
not: !1
|
|
19
17
|
};
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
i,
|
|
18
|
+
function m({ gotoPlace: o }) {
|
|
19
|
+
return /* @__PURE__ */ r(a, { children: c.map((e) => /* @__PURE__ */ r(
|
|
20
|
+
t,
|
|
24
21
|
{
|
|
25
22
|
label: /* @__PURE__ */ r(
|
|
26
|
-
|
|
23
|
+
i,
|
|
27
24
|
{
|
|
28
25
|
variant: "body1",
|
|
29
26
|
sx: {
|
|
@@ -38,14 +35,14 @@ function S({ gotoPlace: o }) {
|
|
|
38
35
|
),
|
|
39
36
|
onClick: () => {
|
|
40
37
|
const n = {
|
|
41
|
-
...
|
|
38
|
+
...s,
|
|
42
39
|
queryTerm: [e],
|
|
43
|
-
booleanQuery: e == "Cancer" ? [
|
|
40
|
+
booleanQuery: e == "Cancer" ? [l] : void 0
|
|
44
41
|
};
|
|
45
42
|
o(
|
|
46
|
-
|
|
43
|
+
`/SearchV2:default?query=${encodeURIComponent(
|
|
47
44
|
JSON.stringify(n)
|
|
48
|
-
)}`
|
|
45
|
+
)}`
|
|
49
46
|
);
|
|
50
47
|
},
|
|
51
48
|
variant: "outlined",
|
|
@@ -60,6 +57,6 @@ function S({ gotoPlace: o }) {
|
|
|
60
57
|
)) });
|
|
61
58
|
}
|
|
62
59
|
export {
|
|
63
|
-
|
|
60
|
+
m as SynapseSearchChips
|
|
64
61
|
};
|
|
65
62
|
//# sourceMappingURL=SynapseSearchChips.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseSearchChips.js","sources":["../../../src/components/SynapseHomepageV2/SynapseSearchChips.tsx"],"sourcesContent":["import { Chip, Typography } from '@mui/material'\nimport {
|
|
1
|
+
{"version":3,"file":"SynapseSearchChips.js","sources":["../../../src/components/SynapseHomepageV2/SynapseSearchChips.tsx"],"sourcesContent":["import { Chip, Typography } from '@mui/material'\nimport { SearchQuery, KeyValue } from '@sage-bionetworks/synapse-types'\nimport { DEFAULT_SEARCH_QUERY } from '@/utils/searchDefaults'\n\nconst searchValues = [\n \"Alzheimer's Disease\",\n 'Neurofibromatosis mouse models',\n 'Cancer',\n 'UK Biobank',\n 'Single-cell analysis of breast cancer',\n 'ROSMAP Religious Orders Study and Memory and Aging Project',\n 'Retinal regeneration studies',\n 'Machine Learning datasets',\n]\n\nconst projectKeyValue: KeyValue = {\n key: 'node_type',\n value: 'project',\n not: false,\n}\n\nexport type SynapseSearchChipsProps = {\n gotoPlace: (href: string) => void\n}\n\nexport function SynapseSearchChips({ gotoPlace }: SynapseSearchChipsProps) {\n return (\n <>\n {searchValues.map(value => {\n return (\n <Chip\n key={value}\n label={\n <Typography\n variant=\"body1\"\n sx={{\n fontSize: '18px',\n fontWeight: 400,\n p: '10px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {value}\n </Typography>\n }\n onClick={() => {\n const searchQuery: SearchQuery = {\n ...DEFAULT_SEARCH_QUERY,\n queryTerm: [value],\n booleanQuery: value == 'Cancer' ? [projectKeyValue] : undefined,\n }\n gotoPlace(\n `/SearchV2:default?query=${encodeURIComponent(\n JSON.stringify(searchQuery),\n )}`,\n )\n }}\n variant=\"outlined\"\n // by default, on hover the background color changes to mostly transparent (4%), which looks terrible on top of the header splash image\n sx={{\n color: 'secondary.600',\n backgroundColor: 'secondary.100',\n borderWidth: '0px',\n '&:hover': { backgroundColor: '#B5D3CE !important' },\n }}\n />\n )\n })}\n </>\n )\n}\n"],"names":["searchValues","projectKeyValue","SynapseSearchChips","gotoPlace","jsx","Fragment","value","Chip","Typography","searchQuery","DEFAULT_SEARCH_QUERY"],"mappings":";;;AAIA,MAAMA,IAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAA4B;AAAA,EAChC,KAAK;AAAA,EACL,OAAO;AAAA,EACP,KAAK;AACP;AAMO,SAASC,EAAmB,EAAE,WAAAC,KAAsC;AACzE,SACE,gBAAAC,EAAAC,GAAA,EACG,UAAAL,EAAa,IAAI,CAAAM,MAEd,gBAAAF;AAAA,IAACG;AAAA,IAAA;AAAA,MAEC,OACE,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,IAAI;AAAA,YACF,UAAU;AAAA,YACV,YAAY;AAAA,YACZ,GAAG;AAAA,YACH,UAAU;AAAA,YACV,cAAc;AAAA,UAAA;AAAA,UAGf,UAAAF;AAAA,QAAA;AAAA,MAAA;AAAA,MAGL,SAAS,MAAM;AACb,cAAMG,IAA2B;AAAA,UAC/B,GAAGC;AAAA,UACH,WAAW,CAACJ,CAAK;AAAA,UACjB,cAAcA,KAAS,WAAW,CAACL,CAAe,IAAI;AAAA,QAAA;AAExD,QAAAE;AAAA,UACE,2BAA2B;AAAA,YACzB,KAAK,UAAUM,CAAW;AAAA,UAAA,CAC3B;AAAA,QAAA;AAAA,MAEL;AAAA,MACA,SAAQ;AAAA,MAER,IAAI;AAAA,QACF,OAAO;AAAA,QACP,iBAAiB;AAAA,QACjB,aAAa;AAAA,QACb,WAAW,EAAE,iBAAiB,qBAAA;AAAA,MAAqB;AAAA,IACrD;AAAA,IAlCKH;AAAA,EAAA,CAqCV,EAAA,CACH;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseNavDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseNavDrawer/SynapseNavDrawer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SynapseNavDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/SynapseNavDrawer/SynapseNavDrawer.tsx"],"names":[],"mappings":"AAmCA,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAcD,oBAAY,OAAO;IACjB,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,KAAK,IAAA;IACL,UAAU,IAAA;IACV,SAAS,IAAA;IACT,MAAM,IAAA;IACN,OAAO,IAAA;IACP,IAAI,IAAA;CACL;AAED,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,EAAE,WAMjD,CAAA;AA6ED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,UAAkB,EAClB,SAAS,GACV,EAAE,qBAAqB,2CAudvB;AAED,eAAe,gBAAgB,CAAA"}
|