@bento-core/table 1.0.1-ins.9 → 1.0.1-popsci.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/ExtendedView.js +15 -22
- package/dist/TableView.js +16 -17
- package/dist/body/DefaultThemConfig.js +1 -1
- package/dist/body/DisplayBodyCell.js +0 -12
- package/dist/body/components/CheckBoxView.js +4 -1
- package/dist/header/DefaultThemConfig.js +2 -2
- package/dist/header/components/CheckBoxView.js +2 -1
- package/dist/header/components/DeleteCellView.js +6 -2
- package/dist/header/components/RemoveAllDialog.js +8 -4
- package/dist/index.js +6 -0
- package/dist/pagination/CustomPagination.js +8 -68
- package/dist/toolbar/DownloadButtonView.js +22 -17
- package/dist/util/Types.js +1 -7
- package/package.json +8 -15
- package/src/ExtendedView.js +34 -40
- package/src/TableView.js +36 -32
- package/src/body/DefaultThemConfig.js +1 -1
- package/src/body/DisplayBodyCell.js +0 -16
- package/src/body/components/CheckBoxView.js +1 -0
- package/src/header/DefaultThemConfig.js +2 -2
- package/src/header/components/CheckBoxView.js +1 -0
- package/src/header/components/DeleteCellView.js +9 -1
- package/src/header/components/RemoveAllDialog.js +6 -3
- package/src/index.js +1 -0
- package/src/pagination/CustomPagination.js +16 -90
- package/src/toolbar/DownloadButtonView.js +29 -20
- package/src/util/Types.js +0 -4
- package/dist/body/components/ConditionalExternalLinkView.js +0 -51
- package/dist/body/components/ExternalLinkView.js +0 -49
- package/src/body/components/ConditionalExternalLinkView.js +0 -43
- package/src/body/components/ExternalLinkView.js +0 -39
package/src/TableView.js
CHANGED
|
@@ -12,7 +12,6 @@ import CustomTableBody from './body/CustomTblBody';
|
|
|
12
12
|
import CustomToolbar from './toolbar/CustomToolbar';
|
|
13
13
|
import DisplayErrMsg from './errMsg/DisplayErrMsg';
|
|
14
14
|
import ExtendedView from './ExtendedView';
|
|
15
|
-
import DownloadButton from './toolbar/DownloadButtonView';
|
|
16
15
|
|
|
17
16
|
const CustomTableContainer = (props) => {
|
|
18
17
|
const { children, customTheme } = props;
|
|
@@ -26,14 +25,9 @@ const CustomTableContainer = (props) => {
|
|
|
26
25
|
);
|
|
27
26
|
};
|
|
28
27
|
|
|
29
|
-
const downloadAreaStyle = {
|
|
30
|
-
display: 'flex',
|
|
31
|
-
paddingRight: '41px',
|
|
32
|
-
float: 'right',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
28
|
const TableView = ({
|
|
36
29
|
tableRows = [],
|
|
30
|
+
totalRows = [],
|
|
37
31
|
table,
|
|
38
32
|
onRowsPerPageChange,
|
|
39
33
|
onPageChange,
|
|
@@ -44,10 +38,14 @@ const TableView = ({
|
|
|
44
38
|
onColumnViewChange,
|
|
45
39
|
themeConfig = {},
|
|
46
40
|
queryVariables,
|
|
41
|
+
server,
|
|
42
|
+
customTableHeader: CustomTableHeader = TableHeader,
|
|
47
43
|
}) => (
|
|
48
44
|
<>
|
|
49
45
|
<ExtendedView
|
|
50
46
|
table={table}
|
|
47
|
+
rows={totalRows}
|
|
48
|
+
server={server}
|
|
51
49
|
onColumnViewChange={onColumnViewChange}
|
|
52
50
|
onRowsPerPageChange={onRowsPerPageChange}
|
|
53
51
|
onPageChange={onPageChange}
|
|
@@ -65,14 +63,27 @@ const TableView = ({
|
|
|
65
63
|
customTheme={themeConfig.tblContainer || {}}
|
|
66
64
|
>
|
|
67
65
|
<Table>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
{
|
|
67
|
+
CustomTableHeader ? (
|
|
68
|
+
<CustomTableHeader
|
|
69
|
+
customTheme={themeConfig.tblHeader}
|
|
70
|
+
table={table}
|
|
71
|
+
rows={tableRows}
|
|
72
|
+
count={totalRowCount}
|
|
73
|
+
toggleSelectAll={onToggleSelectAll}
|
|
74
|
+
sortByColumn={onSortByColumn}
|
|
75
|
+
/>
|
|
76
|
+
) : (
|
|
77
|
+
<TableHeader
|
|
78
|
+
customTheme={themeConfig.tblHeader}
|
|
79
|
+
table={table}
|
|
80
|
+
rows={tableRows}
|
|
81
|
+
count={totalRowCount}
|
|
82
|
+
toggleSelectAll={onToggleSelectAll}
|
|
83
|
+
sortByColumn={onSortByColumn}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
76
87
|
<CustomTableBody
|
|
77
88
|
customTheme={themeConfig.tblBody}
|
|
78
89
|
rows={tableRows}
|
|
@@ -87,23 +98,16 @@ const TableView = ({
|
|
|
87
98
|
table={table}
|
|
88
99
|
/>
|
|
89
100
|
)}
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/>
|
|
101
|
-
<DownloadButton
|
|
102
|
-
count={table.totalRowCount || 0}
|
|
103
|
-
queryVariables={queryVariables}
|
|
104
|
-
table={table}
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
101
|
+
<CustomPagination
|
|
102
|
+
customTheme={themeConfig.tblPgn}
|
|
103
|
+
rowsPerPageOptions={[10, 25, 50, 100]}
|
|
104
|
+
component="div"
|
|
105
|
+
count={table.totalRowCount || 0}
|
|
106
|
+
rowsPerPage={table.rowsPerPage || 10}
|
|
107
|
+
page={table.page || 0}
|
|
108
|
+
onPageChange={onPageChange}
|
|
109
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
110
|
+
/>
|
|
107
111
|
</>
|
|
108
112
|
);
|
|
109
113
|
|
|
@@ -5,8 +5,6 @@ import {
|
|
|
5
5
|
} from '@material-ui/core';
|
|
6
6
|
import { cellTypes } from '../util/Types';
|
|
7
7
|
import CustomLinkView from './components/CustomLinkView';
|
|
8
|
-
import ExternalLinkView from './components/ExternalLinkView';
|
|
9
|
-
import ConditionalExternalLinkView from './components/ConditionalExternalLinkView';
|
|
10
8
|
import DataFormatView from './components/DataFormatView';
|
|
11
9
|
|
|
12
10
|
/**
|
|
@@ -48,20 +46,6 @@ const ViewCell = ({
|
|
|
48
46
|
column={column}
|
|
49
47
|
/>
|
|
50
48
|
);
|
|
51
|
-
case cellTypes.EXTERNAL_LINK:
|
|
52
|
-
return (
|
|
53
|
-
<ExternalLinkView
|
|
54
|
-
row={row}
|
|
55
|
-
column={column}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
case cellTypes.CONDITIONAL_EXTERNAL_LINK:
|
|
59
|
-
return (
|
|
60
|
-
<ConditionalExternalLinkView
|
|
61
|
-
row={row}
|
|
62
|
-
column={column}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
49
|
case cellTypes.CUSTOM_ELEM:
|
|
66
50
|
return (
|
|
67
51
|
<CustomComponent
|
|
@@ -63,13 +63,13 @@ const defaultTheme = () => ({
|
|
|
63
63
|
width: '133px',
|
|
64
64
|
height: '45px',
|
|
65
65
|
cursor: 'pointer',
|
|
66
|
-
background: '#
|
|
66
|
+
background: '#3E74B6',
|
|
67
67
|
},
|
|
68
68
|
'&.cancelBtn': {
|
|
69
69
|
width: '133px',
|
|
70
70
|
height: '45px',
|
|
71
71
|
cursor: 'pointer',
|
|
72
|
-
background: '#
|
|
72
|
+
background: '#4F5D69',
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
75
|
},
|
|
@@ -31,7 +31,13 @@ const DeleteCellView = ({
|
|
|
31
31
|
const testTrigger = () => {
|
|
32
32
|
setDisplay(true);
|
|
33
33
|
};
|
|
34
|
-
const {
|
|
34
|
+
const {
|
|
35
|
+
customColHeaderRender,
|
|
36
|
+
customModalMessage,
|
|
37
|
+
cancelText,
|
|
38
|
+
okText,
|
|
39
|
+
} = column;
|
|
40
|
+
|
|
35
41
|
return (
|
|
36
42
|
<>
|
|
37
43
|
<TableCell
|
|
@@ -70,6 +76,8 @@ const DeleteCellView = ({
|
|
|
70
76
|
count={count}
|
|
71
77
|
toggleDisplay={toggleDialogDisplay}
|
|
72
78
|
customModalMessage={customModalMessage}
|
|
79
|
+
cancelText={cancelText}
|
|
80
|
+
okText={okText}
|
|
73
81
|
/>
|
|
74
82
|
</TableCell>
|
|
75
83
|
</>
|
|
@@ -14,6 +14,8 @@ function RemoveAllDialogView(props) {
|
|
|
14
14
|
count,
|
|
15
15
|
removeAllFiles,
|
|
16
16
|
customModalMessage,
|
|
17
|
+
cancelText = 'No',
|
|
18
|
+
okText = 'Yes',
|
|
17
19
|
} = props;
|
|
18
20
|
const deleteAllFiles = () => {
|
|
19
21
|
removeAllFiles();
|
|
@@ -38,6 +40,7 @@ function RemoveAllDialogView(props) {
|
|
|
38
40
|
</>
|
|
39
41
|
);
|
|
40
42
|
};
|
|
43
|
+
|
|
41
44
|
return (
|
|
42
45
|
<>
|
|
43
46
|
<Dialog
|
|
@@ -50,12 +53,12 @@ function RemoveAllDialogView(props) {
|
|
|
50
53
|
{generateModalMessage(count)}
|
|
51
54
|
</DialogContentText>
|
|
52
55
|
</DialogContent>
|
|
53
|
-
<DialogActions>
|
|
56
|
+
<DialogActions className="actionsWrapper">
|
|
54
57
|
<Button className="okBtn" onClick={deleteAllFiles}>
|
|
55
|
-
|
|
58
|
+
{okText}
|
|
56
59
|
</Button>
|
|
57
60
|
<Button className="cancelBtn" onClick={() => toggleDisplay()}>
|
|
58
|
-
|
|
61
|
+
{cancelText}
|
|
59
62
|
</Button>
|
|
60
63
|
</DialogActions>
|
|
61
64
|
</Dialog>
|
package/src/index.js
CHANGED
|
@@ -5,79 +5,6 @@ import {
|
|
|
5
5
|
TablePagination,
|
|
6
6
|
ThemeProvider,
|
|
7
7
|
} from '@material-ui/core';
|
|
8
|
-
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
9
|
-
import IconButton from '@material-ui/core/IconButton';
|
|
10
|
-
import FirstPageIcon from '@material-ui/icons/FirstPage';
|
|
11
|
-
import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft';
|
|
12
|
-
import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight';
|
|
13
|
-
import LastPageIcon from '@material-ui/icons/LastPage';
|
|
14
|
-
|
|
15
|
-
const useStyles1 = makeStyles((theme) => ({
|
|
16
|
-
root: {
|
|
17
|
-
flexShrink: 0,
|
|
18
|
-
marginLeft: theme.spacing(2.5),
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
function TablePaginationActions(props) {
|
|
23
|
-
const classes = useStyles1();
|
|
24
|
-
const theme = useTheme();
|
|
25
|
-
const {
|
|
26
|
-
count, page, rowsPerPage, onPageChange,
|
|
27
|
-
} = props;
|
|
28
|
-
|
|
29
|
-
const handleFirstPageButtonClick = (event) => {
|
|
30
|
-
onPageChange(event, 0);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const handleBackButtonClick = (event) => {
|
|
34
|
-
onPageChange(event, page - 1);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const handleNextButtonClick = (event) => {
|
|
38
|
-
onPageChange(event, page + 1);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const handleLastPageButtonClick = (event) => {
|
|
42
|
-
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className={classes.root}>
|
|
47
|
-
<IconButton
|
|
48
|
-
onClick={handleFirstPageButtonClick}
|
|
49
|
-
disabled={page === 0}
|
|
50
|
-
aria-label="first page"
|
|
51
|
-
>
|
|
52
|
-
{theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
|
|
53
|
-
</IconButton>
|
|
54
|
-
<IconButton onClick={handleBackButtonClick} disabled={page === 0} aria-label="previous page">
|
|
55
|
-
{theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
|
|
56
|
-
</IconButton>
|
|
57
|
-
<IconButton
|
|
58
|
-
onClick={handleNextButtonClick}
|
|
59
|
-
disabled={page >= Math.ceil(count / rowsPerPage) - 1}
|
|
60
|
-
aria-label="next page"
|
|
61
|
-
>
|
|
62
|
-
{theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
|
|
63
|
-
</IconButton>
|
|
64
|
-
<IconButton
|
|
65
|
-
onClick={handleLastPageButtonClick}
|
|
66
|
-
disabled={page >= Math.ceil(count / rowsPerPage) - 1}
|
|
67
|
-
aria-label="last page"
|
|
68
|
-
>
|
|
69
|
-
{theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
|
|
70
|
-
</IconButton>
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
TablePaginationActions.propTypes = {
|
|
76
|
-
count: PropTypes.number.isRequired,
|
|
77
|
-
onPageChange: PropTypes.func.isRequired,
|
|
78
|
-
page: PropTypes.number.isRequired,
|
|
79
|
-
rowsPerPage: PropTypes.number.isRequired,
|
|
80
|
-
};
|
|
81
8
|
|
|
82
9
|
const defaultTheme = {
|
|
83
10
|
MuiTablePagination: {
|
|
@@ -105,11 +32,6 @@ const defaultTheme = {
|
|
|
105
32
|
},
|
|
106
33
|
};
|
|
107
34
|
|
|
108
|
-
const downloadAreaStyle = {
|
|
109
|
-
display: 'flex',
|
|
110
|
-
paddingRight: '41px',
|
|
111
|
-
};
|
|
112
|
-
|
|
113
35
|
const CustomPagination = ({
|
|
114
36
|
rowsPerPageOptions,
|
|
115
37
|
count,
|
|
@@ -120,18 +42,22 @@ const CustomPagination = ({
|
|
|
120
42
|
customTheme = {},
|
|
121
43
|
}) => (
|
|
122
44
|
<ThemeProvider theme={createTheme({ overrides: { ...defaultTheme, ...customTheme } })}>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
45
|
+
<TablePagination
|
|
46
|
+
rowsPerPageOptions={rowsPerPageOptions}
|
|
47
|
+
component="div"
|
|
48
|
+
count={count}
|
|
49
|
+
rowsPerPage={rowsPerPage}
|
|
50
|
+
page={page}
|
|
51
|
+
onPageChange={onPageChange}
|
|
52
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
53
|
+
SelectProps={{
|
|
54
|
+
inputProps: {
|
|
55
|
+
'aria-label': 'Select number of rows per page',
|
|
56
|
+
'aria-labelledby': 'rowsPerPageLabel',
|
|
57
|
+
},
|
|
58
|
+
id: 'rowsPerPageLabel',
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
135
61
|
</ThemeProvider>
|
|
136
62
|
);
|
|
137
63
|
|
|
@@ -7,32 +7,30 @@ import {
|
|
|
7
7
|
import { CloudDownload } from '@material-ui/icons';
|
|
8
8
|
import { downloadJson } from '../util/downloadTable';
|
|
9
9
|
|
|
10
|
-
const downloadButtonStyle = {
|
|
11
|
-
color: '#d1d2d3',
|
|
12
|
-
marginTop: '7px',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
10
|
const DownloadButton = ({
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
download,
|
|
12
|
+
rows,
|
|
18
13
|
table,
|
|
14
|
+
queryVariables,
|
|
15
|
+
server,
|
|
19
16
|
}) => {
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
17
|
+
if (!download) {
|
|
18
|
+
return null;
|
|
22
19
|
}
|
|
20
|
+
const {
|
|
21
|
+
downloadCsv = 'download',
|
|
22
|
+
downloadTable,
|
|
23
|
+
downloadFileName,
|
|
24
|
+
} = download;
|
|
23
25
|
|
|
24
26
|
const client = useApolloClient();
|
|
25
27
|
|
|
26
|
-
const downloadFile = 'INS ';
|
|
27
|
-
|
|
28
28
|
async function downloadSCSVFile() {
|
|
29
29
|
const {
|
|
30
30
|
query,
|
|
31
31
|
paginationAPIField,
|
|
32
32
|
} = table;
|
|
33
33
|
|
|
34
|
-
const downloadFileName = downloadFile.concat(paginationAPIField.replace('OverView', ''), ' download');
|
|
35
|
-
|
|
36
34
|
const result = await client.query({
|
|
37
35
|
query,
|
|
38
36
|
variables: {
|
|
@@ -51,17 +49,28 @@ const DownloadButton = ({
|
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
const downloadTableCSV = useCallback(() => {
|
|
54
|
-
|
|
52
|
+
if (downloadTable) {
|
|
53
|
+
downloadTable();
|
|
54
|
+
} else if (!downloadTable && !server) {
|
|
55
|
+
downloadJson(rows, table, downloadFileName);
|
|
56
|
+
} else {
|
|
57
|
+
downloadSCSVFile();
|
|
58
|
+
}
|
|
55
59
|
}, [queryVariables]);
|
|
56
60
|
|
|
57
61
|
return (
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
62
|
+
<>
|
|
63
|
+
<Tooltip
|
|
64
|
+
title={downloadCsv}
|
|
65
|
+
className="download-icon"
|
|
61
66
|
>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
<IconButton
|
|
68
|
+
onClick={downloadTableCSV}
|
|
69
|
+
>
|
|
70
|
+
<CloudDownload />
|
|
71
|
+
</IconButton>
|
|
72
|
+
</Tooltip>
|
|
73
|
+
</>
|
|
65
74
|
);
|
|
66
75
|
};
|
|
67
76
|
|
package/src/util/Types.js
CHANGED
|
@@ -2,8 +2,6 @@ export const CHECKBOX = 'CHECKBOX';
|
|
|
2
2
|
export const DELETE = 'DELETE';
|
|
3
3
|
export const CUSTOM_ELEM = 'CUSTOM_ELEM';
|
|
4
4
|
export const LINK = 'LINK';
|
|
5
|
-
export const EXTERNAL_LINK = 'EXTERNAL_LINK';
|
|
6
|
-
export const CONDITIONAL_EXTERNAL_LINK = 'CONDITIONAL_EXTERNAL_LINK';
|
|
7
5
|
export const DISPLAY = 'DISPLAY';
|
|
8
6
|
export const DEFAULT = 'DEFAULT';
|
|
9
7
|
export const FORMAT_DATA = 'FORMAT_DATA';
|
|
@@ -12,8 +10,6 @@ export const FORMAT_BYTES = 'FORMAT_BYTES';
|
|
|
12
10
|
export const cellTypes = {
|
|
13
11
|
CUSTOM_ELEM,
|
|
14
12
|
LINK,
|
|
15
|
-
EXTERNAL_LINK,
|
|
16
|
-
CONDITIONAL_EXTERNAL_LINK,
|
|
17
13
|
DISPLAY,
|
|
18
14
|
CHECKBOX,
|
|
19
15
|
DELETE,
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _core = require("@material-ui/core");
|
|
9
|
-
var _Types = require("../../util/Types");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
/* eslint-disable no-console */
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Conditional External Link component
|
|
15
|
-
*/
|
|
16
|
-
const ConditionalExternalLinkView = _ref => {
|
|
17
|
-
let {
|
|
18
|
-
column,
|
|
19
|
-
row
|
|
20
|
-
} = _ref;
|
|
21
|
-
const {
|
|
22
|
-
rootPath,
|
|
23
|
-
pathParams
|
|
24
|
-
} = column === null || column === void 0 ? void 0 : column.linkAttr;
|
|
25
|
-
const url = pathParams.map(attr => {
|
|
26
|
-
if (!rootPath) {
|
|
27
|
-
return row[attr];
|
|
28
|
-
}
|
|
29
|
-
return "".concat(rootPath, "/").concat(row[attr]);
|
|
30
|
-
});
|
|
31
|
-
const externalLinkIcon = {
|
|
32
|
-
src: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/bento/images/icons/svgs/externalLinkIcon.svg',
|
|
33
|
-
alt: 'External link icon'
|
|
34
|
-
};
|
|
35
|
-
return !url[0] || url[0] === '' ? '' : /*#__PURE__*/_react.default.createElement(_core.Link, {
|
|
36
|
-
href: url,
|
|
37
|
-
target: "_blank",
|
|
38
|
-
rel: "noopener noreferrer",
|
|
39
|
-
className: _Types.cellTypes.LINK
|
|
40
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Typography, null, row[column === null || column === void 0 ? void 0 : column.dataField], /*#__PURE__*/_react.default.createElement("img", {
|
|
41
|
-
src: externalLinkIcon.src,
|
|
42
|
-
alt: externalLinkIcon.alt,
|
|
43
|
-
style: {
|
|
44
|
-
width: '16px',
|
|
45
|
-
verticalAlign: 'sub',
|
|
46
|
-
marginLeft: '4px'
|
|
47
|
-
}
|
|
48
|
-
})));
|
|
49
|
-
};
|
|
50
|
-
var _default = ConditionalExternalLinkView;
|
|
51
|
-
exports.default = _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _core = require("@material-ui/core");
|
|
9
|
-
var _Types = require("../../util/Types");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
/**
|
|
12
|
-
* External Link component
|
|
13
|
-
*/
|
|
14
|
-
const ExternalLinkView = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
column,
|
|
17
|
-
row
|
|
18
|
-
} = _ref;
|
|
19
|
-
const {
|
|
20
|
-
rootPath,
|
|
21
|
-
pathParams
|
|
22
|
-
} = column === null || column === void 0 ? void 0 : column.linkAttr;
|
|
23
|
-
const url = pathParams.map(attr => {
|
|
24
|
-
if (!rootPath) {
|
|
25
|
-
return row[attr];
|
|
26
|
-
}
|
|
27
|
-
return "".concat(rootPath, "/").concat(row[attr]);
|
|
28
|
-
});
|
|
29
|
-
const externalLinkIcon = {
|
|
30
|
-
src: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/bento/images/icons/svgs/externalLinkIcon.svg',
|
|
31
|
-
alt: 'External link icon'
|
|
32
|
-
};
|
|
33
|
-
return /*#__PURE__*/_react.default.createElement(_core.Link, {
|
|
34
|
-
href: url,
|
|
35
|
-
target: "_blank",
|
|
36
|
-
rel: "noopener noreferrer",
|
|
37
|
-
className: _Types.cellTypes.LINK
|
|
38
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Typography, null, row[column === null || column === void 0 ? void 0 : column.dataField], /*#__PURE__*/_react.default.createElement("img", {
|
|
39
|
-
src: externalLinkIcon.src,
|
|
40
|
-
alt: externalLinkIcon.alt,
|
|
41
|
-
style: {
|
|
42
|
-
width: '16px',
|
|
43
|
-
verticalAlign: 'sub',
|
|
44
|
-
marginLeft: '4px'
|
|
45
|
-
}
|
|
46
|
-
})));
|
|
47
|
-
};
|
|
48
|
-
var _default = ExternalLinkView;
|
|
49
|
-
exports.default = _default;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
Link, Typography,
|
|
5
|
-
} from '@material-ui/core';
|
|
6
|
-
import { cellTypes } from '../../util/Types';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Conditional External Link component
|
|
10
|
-
*/
|
|
11
|
-
const ConditionalExternalLinkView = ({
|
|
12
|
-
column,
|
|
13
|
-
row,
|
|
14
|
-
}) => {
|
|
15
|
-
const { rootPath, pathParams } = column?.linkAttr;
|
|
16
|
-
const url = pathParams.map((attr) => {
|
|
17
|
-
if (!rootPath) {
|
|
18
|
-
return row[attr];
|
|
19
|
-
}
|
|
20
|
-
return `${rootPath}/`.concat(row[attr]);
|
|
21
|
-
});
|
|
22
|
-
const externalLinkIcon = {
|
|
23
|
-
src: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/bento/images/icons/svgs/externalLinkIcon.svg',
|
|
24
|
-
alt: 'External link icon',
|
|
25
|
-
};
|
|
26
|
-
return (
|
|
27
|
-
!url[0] || url[0] === '' ? ''
|
|
28
|
-
: (
|
|
29
|
-
<Link href={url} target="_blank" rel="noopener noreferrer" className={cellTypes.LINK}>
|
|
30
|
-
<Typography>
|
|
31
|
-
{row[column?.dataField]}
|
|
32
|
-
<img
|
|
33
|
-
src={externalLinkIcon.src}
|
|
34
|
-
alt={externalLinkIcon.alt}
|
|
35
|
-
style={{ width: '16px', verticalAlign: 'sub', marginLeft: '4px' }}
|
|
36
|
-
/>
|
|
37
|
-
</Typography>
|
|
38
|
-
</Link>
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default ConditionalExternalLinkView;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Link, Typography,
|
|
4
|
-
} from '@material-ui/core';
|
|
5
|
-
import { cellTypes } from '../../util/Types';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* External Link component
|
|
9
|
-
*/
|
|
10
|
-
const ExternalLinkView = ({
|
|
11
|
-
column,
|
|
12
|
-
row,
|
|
13
|
-
}) => {
|
|
14
|
-
const { rootPath, pathParams } = column?.linkAttr;
|
|
15
|
-
const url = pathParams.map((attr) => {
|
|
16
|
-
if (!rootPath) {
|
|
17
|
-
return row[attr];
|
|
18
|
-
}
|
|
19
|
-
return `${rootPath}/`.concat(row[attr]);
|
|
20
|
-
});
|
|
21
|
-
const externalLinkIcon = {
|
|
22
|
-
src: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/bento/images/icons/svgs/externalLinkIcon.svg',
|
|
23
|
-
alt: 'External link icon',
|
|
24
|
-
};
|
|
25
|
-
return (
|
|
26
|
-
<Link href={url} target="_blank" rel="noopener noreferrer" className={cellTypes.LINK}>
|
|
27
|
-
<Typography>
|
|
28
|
-
{row[column?.dataField]}
|
|
29
|
-
<img
|
|
30
|
-
src={externalLinkIcon.src}
|
|
31
|
-
alt={externalLinkIcon.alt}
|
|
32
|
-
style={{ width: '16px', verticalAlign: 'sub', marginLeft: '4px' }}
|
|
33
|
-
/>
|
|
34
|
-
</Typography>
|
|
35
|
-
</Link>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default ExternalLinkView;
|