@bento-core/table 1.0.1-ccdihub.8 → 1.0.1-ccdihub.81
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 +23 -14
- package/dist/TableView.js +73 -6
- package/dist/body/CustomTblBody.js +2 -1
- package/dist/body/DisplayBodyCell.js +13 -3
- package/dist/body/components/CPIModal.js +202 -0
- package/dist/body/components/CPIView.js +115 -0
- package/dist/body/components/ModalStyle.js +107 -0
- package/dist/body/components/assets/CPI_icon.svg +22 -0
- package/dist/header/ActionHeaderCell.js +2 -1
- package/dist/header/CustomCell.js +12 -8
- package/dist/header/CustomTblHeader.js +4 -1
- package/dist/header/components/CheckBoxView.js +8 -3
- package/dist/index.js +6 -0
- package/dist/pagination/CustomPagination.js +11 -2
- package/dist/toolbar/DownloadButtonView.js +169 -7
- package/dist/toolbar/ManageColumnView.js +11 -3
- package/dist/util/Dataformat.js +41 -1
- package/dist/util/Types.js +22 -2
- package/dist/util/downloadTable.js +196 -0
- package/package.json +4 -1
- package/src/ExtendedView.js +34 -21
- package/src/TableView.js +119 -52
- package/src/body/CustomTblBody.js +1 -0
- package/src/body/DisplayBodyCell.js +12 -0
- package/src/body/components/CPIModal.js +233 -0
- package/src/body/components/CPIView.js +133 -0
- package/src/body/components/ModalStyle.js +101 -0
- package/src/body/components/assets/CPI_icon.svg +22 -0
- package/src/header/ActionHeaderCell.js +1 -1
- package/src/header/CustomCell.js +13 -1
- package/src/header/CustomTblHeader.js +1 -0
- package/src/header/components/CheckBoxView.js +3 -1
- package/src/index.js +1 -0
- package/src/pagination/CustomPagination.js +4 -1
- package/src/toolbar/DownloadButtonView.js +178 -10
- package/src/toolbar/ManageColumnView.js +3 -3
- package/src/util/Dataformat.js +25 -0
- package/src/util/Types.js +15 -0
- package/src/util/downloadTable.js +138 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertToCSV = convertToCSV;
|
|
7
|
+
exports.createFileName = createFileName;
|
|
8
|
+
exports.downloadCSV = downloadCSV;
|
|
9
|
+
exports.downloadJson = downloadJson;
|
|
10
|
+
var _Dataformat = require("./Dataformat");
|
|
11
|
+
var _Types = require("./Types");
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
+
function createFileName(fileName, type) {
|
|
18
|
+
const date = new Date();
|
|
19
|
+
const yyyy = date.getFullYear();
|
|
20
|
+
let dd = date.getDate();
|
|
21
|
+
let mm = date.getMonth() + 1;
|
|
22
|
+
if (dd < 10) {
|
|
23
|
+
dd = "0".concat(dd);
|
|
24
|
+
}
|
|
25
|
+
if (mm < 10) {
|
|
26
|
+
mm = "0".concat(mm);
|
|
27
|
+
}
|
|
28
|
+
const todaysDate = "".concat(yyyy, "-").concat(mm, "-").concat(dd);
|
|
29
|
+
let hours = date.getHours();
|
|
30
|
+
let minutes = date.getMinutes();
|
|
31
|
+
let seconds = date.getSeconds();
|
|
32
|
+
if (hours < 10) {
|
|
33
|
+
hours = "0".concat(hours);
|
|
34
|
+
}
|
|
35
|
+
if (minutes < 10) {
|
|
36
|
+
minutes = "0".concat(minutes);
|
|
37
|
+
}
|
|
38
|
+
if (seconds < 10) {
|
|
39
|
+
seconds = "0".concat(seconds);
|
|
40
|
+
}
|
|
41
|
+
if (type === 'csv') {
|
|
42
|
+
return "".concat(fileName, " ").concat(todaysDate, " ").concat(hours, "-").concat(minutes, "-").concat(seconds, '.csv');
|
|
43
|
+
}
|
|
44
|
+
return "".concat(fileName, " ").concat(todaysDate, " ").concat(hours, "-").concat(minutes, "-").concat(seconds, '.json');
|
|
45
|
+
}
|
|
46
|
+
function convertToCSV(jsonse, keysToInclude, header) {
|
|
47
|
+
const objArray = jsonse;
|
|
48
|
+
// To Do empty object just print headers
|
|
49
|
+
const array = typeof objArray !== 'object' ? JSON.parse(objArray) : objArray;
|
|
50
|
+
let str = header.join(',');
|
|
51
|
+
array.map((entry, index) => {
|
|
52
|
+
let line = '';
|
|
53
|
+
keysToInclude.map(keyName => {
|
|
54
|
+
if (line !== '') line += ',';
|
|
55
|
+
if (keyName === 'file_size') {
|
|
56
|
+
line += entry[keyName] !== null ? "\"".concat((0, _Dataformat.formatBytes)(entry[keyName]), "\"") : ' ';
|
|
57
|
+
} else if (keyName === 'age_at_diagnosis' || keyName === 'participant_age_at_collection') {
|
|
58
|
+
if (entry[keyName] === -999) {
|
|
59
|
+
line += 'Not Reported';
|
|
60
|
+
} else {
|
|
61
|
+
line += entry[keyName] !== null ? "\"".concat(entry[keyName], "\"") : ' ';
|
|
62
|
+
}
|
|
63
|
+
} else if (keyName === 'last_known_survival_status' || keyName === 'sample_id' || keyName === 'data_category') {
|
|
64
|
+
if (!entry[keyName] || entry[keyName] === '[]') {
|
|
65
|
+
line += '';
|
|
66
|
+
} else if (entry[keyName].toString().charAt(0) === '[' && entry[keyName].toString().charAt(entry[keyName].toString().length - 1) === ']') {
|
|
67
|
+
line += "\"".concat(entry[keyName].toString().substring(1, entry[keyName].length - 1), "\"");
|
|
68
|
+
} else {
|
|
69
|
+
line += "\"".concat(entry[keyName], "\"");
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
line += entry[keyName] !== null ? "\"".concat(entry[keyName], "\"") : ' ';
|
|
73
|
+
}
|
|
74
|
+
return line;
|
|
75
|
+
});
|
|
76
|
+
if (index === 0) {
|
|
77
|
+
// str = header.join(',');
|
|
78
|
+
str += "\r\n".concat(line, "\r\n");
|
|
79
|
+
} else {
|
|
80
|
+
str += "".concat(line, "\r\n");
|
|
81
|
+
}
|
|
82
|
+
return str;
|
|
83
|
+
});
|
|
84
|
+
return str;
|
|
85
|
+
}
|
|
86
|
+
function downloadCSV(tableData, table, downloadFileName) {
|
|
87
|
+
const {
|
|
88
|
+
columns = []
|
|
89
|
+
} = table;
|
|
90
|
+
const filterColumns = columns.filter(_ref => {
|
|
91
|
+
let {
|
|
92
|
+
cellType
|
|
93
|
+
} = _ref;
|
|
94
|
+
return !_Types.actionCellTypes.includes(cellType);
|
|
95
|
+
}).filter(_ref2 => {
|
|
96
|
+
let {
|
|
97
|
+
cellStyle
|
|
98
|
+
} = _ref2;
|
|
99
|
+
return !_Types.notIncludedCellStyle.includes(cellStyle);
|
|
100
|
+
}).filter(_ref3 => {
|
|
101
|
+
let {
|
|
102
|
+
display
|
|
103
|
+
} = _ref3;
|
|
104
|
+
return display;
|
|
105
|
+
});
|
|
106
|
+
const formatDataVal = (0, _Dataformat.formatColumnValues)(filterColumns, tableData);
|
|
107
|
+
const jsonse = JSON.stringify(formatDataVal);
|
|
108
|
+
const keysToInclude = filterColumns.filter(_ref4 => {
|
|
109
|
+
let {
|
|
110
|
+
dataField
|
|
111
|
+
} = _ref4;
|
|
112
|
+
return dataField;
|
|
113
|
+
}).map(_ref5 => {
|
|
114
|
+
let {
|
|
115
|
+
dataField
|
|
116
|
+
} = _ref5;
|
|
117
|
+
return dataField;
|
|
118
|
+
});
|
|
119
|
+
const headers = filterColumns.filter(_ref6 => {
|
|
120
|
+
let {
|
|
121
|
+
dataField
|
|
122
|
+
} = _ref6;
|
|
123
|
+
return dataField;
|
|
124
|
+
}).map(_ref7 => {
|
|
125
|
+
let {
|
|
126
|
+
header,
|
|
127
|
+
downloadHeader
|
|
128
|
+
} = _ref7;
|
|
129
|
+
return downloadHeader || header;
|
|
130
|
+
});
|
|
131
|
+
const csv = convertToCSV(jsonse, keysToInclude, headers);
|
|
132
|
+
const exportData = new Blob([csv], {
|
|
133
|
+
type: 'text/csv'
|
|
134
|
+
});
|
|
135
|
+
const JsonURL = window.URL.createObjectURL(exportData);
|
|
136
|
+
let tempLink = '';
|
|
137
|
+
tempLink = document.createElement('a');
|
|
138
|
+
tempLink.setAttribute('href', JsonURL);
|
|
139
|
+
tempLink.setAttribute('download', createFileName(downloadFileName || '', 'csv'));
|
|
140
|
+
document.body.appendChild(tempLink);
|
|
141
|
+
tempLink.click();
|
|
142
|
+
document.body.removeChild(tempLink);
|
|
143
|
+
}
|
|
144
|
+
function downloadJson(tableData, table, downloadFileName) {
|
|
145
|
+
const {
|
|
146
|
+
columns = []
|
|
147
|
+
} = table;
|
|
148
|
+
const toDelete = columns.filter(e => !e.display);
|
|
149
|
+
const filterColumns = columns.filter(_ref8 => {
|
|
150
|
+
let {
|
|
151
|
+
cellType
|
|
152
|
+
} = _ref8;
|
|
153
|
+
return !_Types.actionCellTypes.includes(cellType);
|
|
154
|
+
}).filter(_ref9 => {
|
|
155
|
+
let {
|
|
156
|
+
display
|
|
157
|
+
} = _ref9;
|
|
158
|
+
return display;
|
|
159
|
+
});
|
|
160
|
+
let formatDataVal = (0, _Dataformat.formatColumnValues)(filterColumns, tableData);
|
|
161
|
+
formatDataVal = formatDataVal.map(entry => {
|
|
162
|
+
let survivalStatus = entry.last_known_survival_status;
|
|
163
|
+
let sampleId = entry.sample_id;
|
|
164
|
+
let dataCategory = entry.data_category;
|
|
165
|
+
const toReturn = _objectSpread({}, entry);
|
|
166
|
+
if (survivalStatus && survivalStatus.toString().charAt(0) === '[' && survivalStatus.toString().charAt(survivalStatus.toString().length - 1) === ']') {
|
|
167
|
+
survivalStatus = survivalStatus.toString().substring(1, survivalStatus.length - 1);
|
|
168
|
+
toReturn['Last Known Survival Status'] = survivalStatus;
|
|
169
|
+
}
|
|
170
|
+
if (sampleId && sampleId.toString().charAt(0) === '[' && sampleId.toString().charAt(sampleId.toString().length - 1) === ']') {
|
|
171
|
+
sampleId = sampleId.toString().substring(1, sampleId.length - 1);
|
|
172
|
+
toReturn['Sample Id'] = sampleId;
|
|
173
|
+
}
|
|
174
|
+
if (dataCategory && dataCategory.toString().charAt(0) === '[' && dataCategory.toString().charAt(dataCategory.toString().length - 1) === ']') {
|
|
175
|
+
dataCategory = dataCategory.toString().substring(1, dataCategory.length - 1);
|
|
176
|
+
toReturn['Data Category'] = dataCategory;
|
|
177
|
+
}
|
|
178
|
+
toDelete.forEach(column => delete toReturn[column.dataField]);
|
|
179
|
+
return toReturn;
|
|
180
|
+
});
|
|
181
|
+
filterColumns.forEach(column => {
|
|
182
|
+
formatDataVal = JSON.parse(JSON.stringify(formatDataVal).split("\"".concat(column.dataField, "\":")).join("\"".concat(column.header, "\":")));
|
|
183
|
+
});
|
|
184
|
+
const jsonse = JSON.stringify(formatDataVal);
|
|
185
|
+
const exportData = new Blob([jsonse], {
|
|
186
|
+
type: 'application/json'
|
|
187
|
+
});
|
|
188
|
+
const JsonURL = window.URL.createObjectURL(exportData);
|
|
189
|
+
let tempLink = '';
|
|
190
|
+
tempLink = document.createElement('a');
|
|
191
|
+
tempLink.setAttribute('href', JsonURL);
|
|
192
|
+
tempLink.setAttribute('download', createFileName(downloadFileName || '', 'json'));
|
|
193
|
+
document.body.appendChild(tempLink);
|
|
194
|
+
tempLink.click();
|
|
195
|
+
document.body.removeChild(tempLink);
|
|
196
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/table",
|
|
3
|
-
"version": "1.0.1-ccdihub.
|
|
3
|
+
"version": "1.0.1-ccdihub.81",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
@@ -28,5 +28,8 @@
|
|
|
28
28
|
"url": "https://github.com/CBIIT/bento-frontend/issues"
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/CBIIT/bento-frontend#readme",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@apollo/client": "^3.8.3"
|
|
33
|
+
},
|
|
31
34
|
"description": ""
|
|
32
35
|
}
|
package/src/ExtendedView.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
ThemeProvider,
|
|
4
|
-
Toolbar,
|
|
5
4
|
createTheme,
|
|
6
5
|
} from '@material-ui/core';
|
|
7
6
|
import CustomPagination from './pagination/CustomPagination';
|
|
@@ -9,20 +8,25 @@ import ManageColumnView from './toolbar/ManageColumnView';
|
|
|
9
8
|
import defaultTheme from './DefaultThemConfig';
|
|
10
9
|
import DownloadButton from './toolbar/DownloadButtonView';
|
|
11
10
|
|
|
11
|
+
const downloadAreaStyle = {
|
|
12
|
+
display: 'flex',
|
|
13
|
+
borderTop: '1px solid #8A7F7C',
|
|
14
|
+
paddingRight: '41px',
|
|
15
|
+
};
|
|
16
|
+
|
|
12
17
|
const ExtendedView = ({
|
|
13
18
|
table,
|
|
14
19
|
onColumnViewChange,
|
|
15
20
|
onRowsPerPageChange,
|
|
16
21
|
onPageChange,
|
|
17
|
-
numSelected = 0,
|
|
18
22
|
customTheme,
|
|
23
|
+
queryVariables,
|
|
19
24
|
}) => {
|
|
20
25
|
const { extendedViewConfig } = table;
|
|
21
26
|
if (!extendedViewConfig) {
|
|
22
27
|
return null;
|
|
23
28
|
}
|
|
24
29
|
const {
|
|
25
|
-
download = false,
|
|
26
30
|
manageViewColumns = false,
|
|
27
31
|
pagination = false,
|
|
28
32
|
} = extendedViewConfig;
|
|
@@ -30,30 +34,39 @@ const ExtendedView = ({
|
|
|
30
34
|
const themeConfig = createTheme({ overrides: { ...defaultTheme(), ...customTheme } });
|
|
31
35
|
return (
|
|
32
36
|
<ThemeProvider theme={themeConfig}>
|
|
33
|
-
{(numSelected === 0 && (download || manageViewColumns)) && (
|
|
37
|
+
{/* {(numSelected === 0 && (download || manageViewColumns)) && (
|
|
34
38
|
<Toolbar className="downloadColumnView">
|
|
35
|
-
|
|
39
|
+
<DownloadButton
|
|
36
40
|
download={download}
|
|
37
41
|
/>
|
|
38
|
-
<ManageColumnView
|
|
39
|
-
table={table}
|
|
40
|
-
manageViewColumns={manageViewColumns}
|
|
41
|
-
onColumnViewChange={onColumnViewChange}
|
|
42
|
-
/>
|
|
43
42
|
</Toolbar>
|
|
44
|
-
)}
|
|
43
|
+
)} */}
|
|
45
44
|
{
|
|
46
45
|
(pagination) && (
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
<div className="downloadArea" style={downloadAreaStyle}>
|
|
47
|
+
<CustomPagination
|
|
48
|
+
customTheme={customTheme.tblTopPgn}
|
|
49
|
+
rowsPerPageOptions={[10, 25, 50, 100]}
|
|
50
|
+
component="div"
|
|
51
|
+
count={table.totalRowCount || 0}
|
|
52
|
+
rowsPerPage={table.rowsPerPage || 10}
|
|
53
|
+
page={table.page || 0}
|
|
54
|
+
onPageChange={onPageChange}
|
|
55
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
56
|
+
queryVariables={queryVariables}
|
|
57
|
+
table={table}
|
|
58
|
+
/>
|
|
59
|
+
<DownloadButton
|
|
60
|
+
count={table.totalRowCount || 0}
|
|
61
|
+
queryVariables={queryVariables}
|
|
62
|
+
table={table}
|
|
63
|
+
/>
|
|
64
|
+
<ManageColumnView
|
|
65
|
+
table={table}
|
|
66
|
+
manageViewColumns={manageViewColumns}
|
|
67
|
+
onColumnViewChange={onColumnViewChange}
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
57
70
|
)
|
|
58
71
|
}
|
|
59
72
|
</ThemeProvider>
|
package/src/TableView.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Paper,
|
|
4
4
|
Table,
|
|
@@ -12,19 +12,46 @@ 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
|
+
import ManageColumnView from './toolbar/ManageColumnView';
|
|
15
17
|
|
|
16
18
|
const CustomTableContainer = (props) => {
|
|
17
19
|
const { children, customTheme } = props;
|
|
18
20
|
const themeConfig = createTheme({ overrides: { ...customTheme } });
|
|
19
21
|
return (
|
|
20
22
|
<ThemeProvider theme={themeConfig}>
|
|
21
|
-
<TableContainer component={Paper}>
|
|
23
|
+
<TableContainer id="tableContainer" component={Paper}>
|
|
22
24
|
{children}
|
|
23
25
|
</TableContainer>
|
|
24
26
|
</ThemeProvider>
|
|
25
27
|
);
|
|
26
28
|
};
|
|
27
29
|
|
|
30
|
+
const downloadAreaStyle = {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
borderTop: '1px solid #8A7F7C',
|
|
33
|
+
borderBottom: '1px solid #8A7F7C',
|
|
34
|
+
paddingRight: '41px',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const cartDownloadAreaStyle = {
|
|
38
|
+
display: 'flex',
|
|
39
|
+
borderTop: '5px solid #e7e5e5',
|
|
40
|
+
borderBottom: '3px solid #e7e5e5',
|
|
41
|
+
paddingRight: '40px',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const addScrollContainerStyle = {
|
|
45
|
+
overflowX: 'auto',
|
|
46
|
+
overflowY: 'hidden',
|
|
47
|
+
width: '100%',
|
|
48
|
+
height: '14px',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const addScrollStyle = {
|
|
52
|
+
height: '14px',
|
|
53
|
+
};
|
|
54
|
+
|
|
28
55
|
const TableView = ({
|
|
29
56
|
tableRows = [],
|
|
30
57
|
table,
|
|
@@ -36,59 +63,99 @@ const TableView = ({
|
|
|
36
63
|
onSortByColumn,
|
|
37
64
|
onColumnViewChange,
|
|
38
65
|
themeConfig = {},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
queryVariables,
|
|
67
|
+
}) => {
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const tableContainer = document.getElementById('tableContainer');
|
|
70
|
+
const addScrollContainer = document.getElementById('addScrollContainer');
|
|
71
|
+
const targetTable = tableContainer.firstChild;
|
|
72
|
+
const addScroll = addScrollContainer.firstChild;
|
|
73
|
+
const tableWidth = targetTable.clientWidth;
|
|
74
|
+
addScroll.style.width = `${tableWidth}px`;
|
|
75
|
+
tableContainer.onscroll = () => {
|
|
76
|
+
addScrollContainer.scrollLeft = tableContainer.scrollLeft;
|
|
77
|
+
};
|
|
78
|
+
addScrollContainer.onscroll = () => {
|
|
79
|
+
tableContainer.scrollLeft = addScrollContainer.scrollLeft;
|
|
80
|
+
};
|
|
81
|
+
if (!(tableWidth > tableContainer.clientWidth)) {
|
|
82
|
+
addScrollContainer.style.height = '0px';
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const { extendedViewConfig } = table;
|
|
86
|
+
const {
|
|
87
|
+
manageViewColumns = false,
|
|
88
|
+
} = extendedViewConfig;
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<ExtendedView
|
|
92
|
+
table={table}
|
|
93
|
+
onColumnViewChange={onColumnViewChange}
|
|
94
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
95
|
+
onPageChange={onPageChange}
|
|
96
|
+
numSelected={table?.selectedRows?.length || 0}
|
|
97
|
+
customTheme={themeConfig.extendedView}
|
|
98
|
+
queryVariables={queryVariables}
|
|
99
|
+
/>
|
|
100
|
+
<CustomToolbar
|
|
101
|
+
numSelected={table?.selectedRows?.length || 0}
|
|
102
|
+
table={table}
|
|
103
|
+
onColumnViewChange={onColumnViewChange}
|
|
104
|
+
customTheme={themeConfig.toolbar}
|
|
105
|
+
/>
|
|
106
|
+
<CustomTableContainer
|
|
107
|
+
customTheme={themeConfig.tblContainer || {}}
|
|
108
|
+
>
|
|
109
|
+
<Table>
|
|
110
|
+
<TableHeader
|
|
111
|
+
customTheme={themeConfig.tblHeader}
|
|
112
|
+
table={table}
|
|
113
|
+
rows={tableRows}
|
|
114
|
+
count={totalRowCount}
|
|
115
|
+
toggleSelectAll={onToggleSelectAll}
|
|
116
|
+
sortByColumn={onSortByColumn}
|
|
117
|
+
/>
|
|
118
|
+
<CustomTableBody
|
|
119
|
+
customTheme={themeConfig.tblBody}
|
|
120
|
+
rows={tableRows}
|
|
121
|
+
table={table}
|
|
122
|
+
onRowSelectChange={onRowSelectChange}
|
|
123
|
+
/>
|
|
124
|
+
</Table>
|
|
125
|
+
</CustomTableContainer>
|
|
126
|
+
<div id="addScrollContainer" style={addScrollContainerStyle}>
|
|
127
|
+
<div style={addScrollStyle} />
|
|
128
|
+
</div>
|
|
129
|
+
{tableRows.length === 0 && (
|
|
130
|
+
<DisplayErrMsg
|
|
131
|
+
customTheme={themeConfig.displayErr}
|
|
61
132
|
table={table}
|
|
62
|
-
rows={tableRows}
|
|
63
|
-
count={totalRowCount}
|
|
64
|
-
toggleSelectAll={onToggleSelectAll}
|
|
65
|
-
sortByColumn={onSortByColumn}
|
|
66
133
|
/>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
134
|
+
)}
|
|
135
|
+
<div className="downloadArea" style={table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : downloadAreaStyle}>
|
|
136
|
+
<CustomPagination
|
|
137
|
+
customTheme={themeConfig.tblPgn}
|
|
138
|
+
rowsPerPageOptions={[10, 25, 50, 100]}
|
|
139
|
+
component="div"
|
|
140
|
+
count={table.totalRowCount || 0}
|
|
141
|
+
rowsPerPage={table.rowsPerPage || 10}
|
|
142
|
+
page={table.page || 0}
|
|
143
|
+
onPageChange={onPageChange}
|
|
144
|
+
onRowsPerPageChange={onRowsPerPageChange}
|
|
145
|
+
/>
|
|
146
|
+
<DownloadButton
|
|
147
|
+
count={table.totalRowCount || 0}
|
|
148
|
+
queryVariables={queryVariables}
|
|
70
149
|
table={table}
|
|
71
|
-
onRowSelectChange={onRowSelectChange}
|
|
72
150
|
/>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
customTheme={themeConfig.tblPgn}
|
|
83
|
-
rowsPerPageOptions={[10, 25, 50, 100]}
|
|
84
|
-
component="div"
|
|
85
|
-
count={table.totalRowCount || 0}
|
|
86
|
-
rowsPerPage={table.rowsPerPage || 10}
|
|
87
|
-
page={table.page || 0}
|
|
88
|
-
onPageChange={onPageChange}
|
|
89
|
-
onRowsPerPageChange={onRowsPerPageChange}
|
|
90
|
-
/>
|
|
91
|
-
</>
|
|
92
|
-
);
|
|
151
|
+
<ManageColumnView
|
|
152
|
+
table={table}
|
|
153
|
+
manageViewColumns={manageViewColumns}
|
|
154
|
+
onColumnViewChange={onColumnViewChange}
|
|
155
|
+
/>
|
|
156
|
+
</div>
|
|
157
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
93
160
|
|
|
94
161
|
export default TableView;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import { cellTypes } from '../util/Types';
|
|
7
7
|
import CustomLinkView from './components/CustomLinkView';
|
|
8
8
|
import DataFormatView from './components/DataFormatView';
|
|
9
|
+
import CPIView from './components/CPIView';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Custom Column reneder
|
|
@@ -29,6 +30,7 @@ const CustomComponent = ({
|
|
|
29
30
|
const ViewCell = ({
|
|
30
31
|
column,
|
|
31
32
|
row,
|
|
33
|
+
themeConfig,
|
|
32
34
|
}) => {
|
|
33
35
|
const { cellType } = column;
|
|
34
36
|
switch (cellType) {
|
|
@@ -53,6 +55,14 @@ const ViewCell = ({
|
|
|
53
55
|
column={column}
|
|
54
56
|
/>
|
|
55
57
|
);
|
|
58
|
+
case cellTypes.CPI:
|
|
59
|
+
return (
|
|
60
|
+
<CPIView
|
|
61
|
+
row={row}
|
|
62
|
+
column={column}
|
|
63
|
+
themeConfig={themeConfig}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
56
66
|
default:
|
|
57
67
|
return (
|
|
58
68
|
<Typography>
|
|
@@ -65,11 +75,13 @@ const ViewCell = ({
|
|
|
65
75
|
const DisplayCell = ({
|
|
66
76
|
row,
|
|
67
77
|
column,
|
|
78
|
+
themeConfig,
|
|
68
79
|
}) => (
|
|
69
80
|
<TableCell className={column.dataField}>
|
|
70
81
|
<ViewCell
|
|
71
82
|
row={row}
|
|
72
83
|
column={column}
|
|
84
|
+
themeConfig={themeConfig}
|
|
73
85
|
/>
|
|
74
86
|
</TableCell>
|
|
75
87
|
);
|