@bento-core/table 1.0.1-ccdihub.8 → 1.0.1-ccdihub.80
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 +187 -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 +8 -6
- 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 +227 -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 +11 -1
- 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,22 @@
|
|
|
1
|
+
<svg width="23" height="21" viewBox="0 0 23 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_12066_12050)">
|
|
3
|
+
<path d="M19.0973 13.2173C16.943 13.2173 15.1948 14.9585 15.1948 17.1042C15.1948 19.2499 16.943 20.9912 19.0973 20.9912C21.2516 20.9912 22.9998 19.2499 22.9998 17.1042C22.9998 14.9585 21.2516 13.2173 19.0973 13.2173Z" fill="#07679C"/>
|
|
4
|
+
<path d="M19.389 18.8806L21.5609 16.4447C21.7905 16.1897 21.6051 15.7939 21.2696 15.7939H16.9256C16.5813 15.7939 16.4047 16.1985 16.6343 16.4447L18.8062 18.8806C18.9652 19.0565 19.2389 19.0565 19.3978 18.8806H19.389Z" fill="white"/>
|
|
5
|
+
<g clip-path="url(#clip1_12066_12050)">
|
|
6
|
+
<path d="M5.995 10.579C6.49826 10.579 6.96621 10.4734 7.4165 10.3239C6.15393 9.06641 5.36813 7.31641 5.36813 5.39933C5.36813 4.19455 5.67715 3.06013 6.21573 2.07521C6.1451 2.07521 6.07446 2.05762 6.00383 2.05762C3.63761 2.05762 1.72168 3.96591 1.72168 6.32269C1.72168 8.67948 3.63761 10.5878 6.00383 10.5878L5.995 10.579Z" fill="#07679C"/>
|
|
7
|
+
<path d="M16.1916 9.19803C18.3053 7.09283 18.3053 3.67963 16.1916 1.57443C14.078 -0.530773 10.6511 -0.530773 8.53751 1.57443C6.42388 3.67963 6.42388 7.09283 8.53751 9.19803C10.6511 11.3032 14.078 11.3032 16.1916 9.19803Z" fill="#07679C"/>
|
|
8
|
+
<path d="M13.6409 17.1395C13.6409 14.6948 15.3272 12.6458 17.5963 12.0742C17.1637 11.7312 16.6869 11.4498 16.166 11.2388C15.0712 11.9511 13.7645 12.3732 12.3518 12.3732C10.9391 12.3732 9.64124 11.9511 8.5376 11.2388C6.3303 12.1445 4.77637 14.2991 4.77637 16.8229V17.6848C4.77637 18.3267 5.22666 18.8807 5.86236 19.0038C7.67234 19.3468 9.86197 19.6194 12.3518 19.6194C13.0052 19.6194 13.6232 19.593 14.2324 19.5579C13.8528 18.8368 13.6409 18.0189 13.6409 17.1483V17.1395Z" fill="#07679C"/>
|
|
9
|
+
<path d="M2.63109 11.0981C1.07716 11.8896 0 13.4901 0 15.3544V16.0404C0 16.5504 0.361996 16.9901 0.85643 17.0868C1.56276 17.2187 2.34856 17.3419 3.19616 17.4298V16.823C3.19616 15.0378 3.83186 13.3758 4.90019 12.0567C4.07025 11.8984 3.29328 11.573 2.62227 11.1069L2.63109 11.0981Z" fill="#07679C"/>
|
|
10
|
+
<path d="M15.1948 17.1043C15.1948 19.25 16.943 20.9912 19.0973 20.9912C21.2516 20.9912 22.9998 19.25 22.9998 17.1043C22.9998 14.9585 21.2516 13.2173 19.0973 13.2173C16.943 13.2173 15.1948 14.9585 15.1948 17.1043Z" fill="#07679C"/>
|
|
11
|
+
<path d="M20.8808 16.8143L18.4351 14.651C18.1791 14.4224 17.7817 14.607 17.7817 14.9412L17.7817 19.2678C17.7817 19.6108 18.1879 19.7867 18.4351 19.558L20.8808 17.3947C21.0574 17.2364 21.0574 16.9638 20.8808 16.8055L20.8808 16.8143Z" fill="white"/>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
<defs>
|
|
15
|
+
<clipPath id="clip0_12066_12050">
|
|
16
|
+
<rect width="23" height="21" fill="white"/>
|
|
17
|
+
</clipPath>
|
|
18
|
+
<clipPath id="clip1_12066_12050">
|
|
19
|
+
<rect width="23" height="21" fill="white"/>
|
|
20
|
+
</clipPath>
|
|
21
|
+
</defs>
|
|
22
|
+
</svg>
|
|
@@ -25,7 +25,8 @@ const ActionHeaderCell = _ref => {
|
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement(_CheckBoxView.default, {
|
|
26
26
|
includeSelectedIds: includeSelectedIds,
|
|
27
27
|
toggleSelectAll: toggleSelectAll,
|
|
28
|
-
Ids: Ids
|
|
28
|
+
Ids: Ids,
|
|
29
|
+
rows: rows
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
if (_Types.cellTypes.DELETE === cellType) {
|
|
@@ -29,7 +29,8 @@ const CustomHeaderCell = _ref => {
|
|
|
29
29
|
tooltipText,
|
|
30
30
|
header,
|
|
31
31
|
headerType,
|
|
32
|
-
customColHeaderRender
|
|
32
|
+
customColHeaderRender,
|
|
33
|
+
sortable
|
|
33
34
|
} = column;
|
|
34
35
|
const Tooltip = (0, _react.useCallback)(_ref2 => {
|
|
35
36
|
let {
|
|
@@ -50,15 +51,16 @@ const CustomHeaderCell = _ref => {
|
|
|
50
51
|
// return default view
|
|
51
52
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
|
|
52
53
|
}, []);
|
|
54
|
+
if (sortable !== undefined && !sortable) {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
56
|
+
scope: "col"
|
|
57
|
+
}, header);
|
|
58
|
+
}
|
|
53
59
|
return /*#__PURE__*/_react.default.createElement(_TableCell.default, {
|
|
54
60
|
scope: "col",
|
|
55
61
|
active: sortBy === dataField,
|
|
56
62
|
direction: sortOrder
|
|
57
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
58
|
-
style: {
|
|
59
|
-
display: 'none'
|
|
60
|
-
}
|
|
61
|
-
}, "Select all"), /*#__PURE__*/_react.default.createElement(Tooltip, null, /*#__PURE__*/_react.default.createElement(_TableSortLabel.default, {
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement(Tooltip, null, /*#__PURE__*/_react.default.createElement(_TableSortLabel.default, {
|
|
62
64
|
active: sortBy === dataField,
|
|
63
65
|
hideSortIcon: sortBy !== dataField,
|
|
64
66
|
direction: sortBy === dataField ? sortOrder : 'asc',
|
|
@@ -17,15 +17,20 @@ const CheckboxView = _ref => {
|
|
|
17
17
|
let {
|
|
18
18
|
includeSelectedIds,
|
|
19
19
|
toggleSelectAll,
|
|
20
|
-
Ids
|
|
20
|
+
Ids,
|
|
21
|
+
rows
|
|
21
22
|
} = _ref;
|
|
22
23
|
return /*#__PURE__*/_react.default.createElement(_core.TableCell, {
|
|
23
24
|
padding: "checkbox"
|
|
24
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
26
|
+
style: {
|
|
27
|
+
display: 'none'
|
|
28
|
+
}
|
|
29
|
+
}, "Select all"), /*#__PURE__*/_react.default.createElement(_core.Checkbox, _extends({}, label, {
|
|
25
30
|
color: "primary",
|
|
26
31
|
indeterminate: includeSelectedIds,
|
|
27
32
|
checked: includeSelectedIds,
|
|
28
|
-
onChange: event => toggleSelectAll(event, Ids, includeSelectedIds)
|
|
33
|
+
onChange: event => toggleSelectAll(event, Ids, includeSelectedIds, rows)
|
|
29
34
|
})));
|
|
30
35
|
};
|
|
31
36
|
var _default = CheckboxView;
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "TableView", {
|
|
|
15
15
|
return _TableView.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "cellStyles", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _Types.cellStyles;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "cellTypes", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function get() {
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _core = require("@material-ui/core");
|
|
10
|
+
var _KeyboardArrowDownOutlined = _interopRequireDefault(require("@material-ui/icons/KeyboardArrowDownOutlined"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
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; }
|
|
12
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; }
|
|
@@ -53,6 +54,7 @@ const CustomPagination = _ref => {
|
|
|
53
54
|
overrides: _objectSpread(_objectSpread({}, defaultTheme), customTheme)
|
|
54
55
|
})
|
|
55
56
|
}, /*#__PURE__*/_react.default.createElement(_core.TablePagination, {
|
|
57
|
+
labelRowsPerPage: "Results per Page:",
|
|
56
58
|
rowsPerPageOptions: rowsPerPageOptions,
|
|
57
59
|
component: "div",
|
|
58
60
|
count: count,
|
|
@@ -60,11 +62,18 @@ const CustomPagination = _ref => {
|
|
|
60
62
|
page: page,
|
|
61
63
|
onPageChange: onPageChange,
|
|
62
64
|
onRowsPerPageChange: onRowsPerPageChange,
|
|
65
|
+
labelDisplayedRows: _ref2 => {
|
|
66
|
+
let {
|
|
67
|
+
from,
|
|
68
|
+
to
|
|
69
|
+
} = _ref2;
|
|
70
|
+
return "".concat(from.toLocaleString(), "-").concat(to.toLocaleString(), " of ").concat(count.toLocaleString());
|
|
71
|
+
},
|
|
63
72
|
SelectProps: {
|
|
73
|
+
IconComponent: _KeyboardArrowDownOutlined.default,
|
|
64
74
|
inputProps: {
|
|
65
75
|
'aria-label': 'Selection dropdown for displaying the number of results per page'
|
|
66
|
-
}
|
|
67
|
-
native: true
|
|
76
|
+
}
|
|
68
77
|
}
|
|
69
78
|
}));
|
|
70
79
|
};
|
|
@@ -4,20 +4,182 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _client = require("@apollo/client");
|
|
8
9
|
var _core = require("@material-ui/core");
|
|
10
|
+
var _KeyboardArrowDownOutlined = _interopRequireDefault(require("@material-ui/icons/KeyboardArrowDownOutlined"));
|
|
9
11
|
var _icons = require("@material-ui/icons");
|
|
12
|
+
var _downloadTable = require("../util/downloadTable");
|
|
10
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
20
|
+
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); }
|
|
21
|
+
// const downloadButtonStyle = {
|
|
22
|
+
// color: '#d1d2d3',
|
|
23
|
+
// marginTop: '7px',
|
|
24
|
+
// };
|
|
25
|
+
|
|
11
26
|
const DownloadButton = _ref => {
|
|
12
27
|
let {
|
|
13
|
-
|
|
28
|
+
count,
|
|
29
|
+
queryVariables,
|
|
30
|
+
table
|
|
14
31
|
} = _ref;
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
const [listDisplay, setListDisplay] = (0, _react.useState)('none');
|
|
33
|
+
const dropdownSelection = (0, _react.useRef)(null);
|
|
34
|
+
const useOutsideAlerter = ref => {
|
|
35
|
+
(0, _react.useEffect)(() => {
|
|
36
|
+
function handleClickOutside(event) {
|
|
37
|
+
if (!(event.target.getAttribute('id') && event.target.getAttribute('id').includes('dropdownListItem'))) {
|
|
38
|
+
setListDisplay('none');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
42
|
+
return () => {
|
|
43
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
44
|
+
};
|
|
45
|
+
}, [ref]);
|
|
46
|
+
};
|
|
47
|
+
useOutsideAlerter(dropdownSelection);
|
|
48
|
+
if (table.paginationAPIField === 'filesInList') {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
50
|
+
}
|
|
51
|
+
// if (count === 0) {
|
|
52
|
+
// return <CloudDownload className="disableButton" style={downloadButtonStyle} />;
|
|
53
|
+
// }
|
|
54
|
+
|
|
55
|
+
const client = (0, _client.useApolloClient)();
|
|
56
|
+
async function downloadSCSVFile() {
|
|
57
|
+
const {
|
|
58
|
+
query,
|
|
59
|
+
paginationAPIField
|
|
60
|
+
} = table;
|
|
61
|
+
const result = await client.query({
|
|
62
|
+
query,
|
|
63
|
+
variables: _objectSpread(_objectSpread({}, queryVariables), {}, {
|
|
64
|
+
page: 0,
|
|
65
|
+
first: 200000,
|
|
66
|
+
order_by: table.sortBy,
|
|
67
|
+
sort_direction: table.sortOrder
|
|
68
|
+
})
|
|
69
|
+
}).then(response => {
|
|
70
|
+
if (paginationAPIField && response && response.data) {
|
|
71
|
+
return response.data[paginationAPIField];
|
|
72
|
+
}
|
|
73
|
+
return response.data;
|
|
74
|
+
});
|
|
75
|
+
(0, _downloadTable.downloadCSV)(result, table, table.downloadFileName);
|
|
76
|
+
}
|
|
77
|
+
async function downloadJsonFile() {
|
|
78
|
+
const {
|
|
79
|
+
query,
|
|
80
|
+
paginationAPIField
|
|
81
|
+
} = table;
|
|
82
|
+
const result = await client.query({
|
|
83
|
+
query,
|
|
84
|
+
variables: _objectSpread(_objectSpread({}, queryVariables), {}, {
|
|
85
|
+
page: 0,
|
|
86
|
+
first: 200000,
|
|
87
|
+
order_by: table.sortBy,
|
|
88
|
+
sort_direction: table.sortOrder
|
|
89
|
+
})
|
|
90
|
+
}).then(response => {
|
|
91
|
+
if (paginationAPIField && response && response.data) {
|
|
92
|
+
return response.data[paginationAPIField];
|
|
93
|
+
}
|
|
94
|
+
return response.data;
|
|
95
|
+
});
|
|
96
|
+
(0, _downloadTable.downloadJson)(result, table, table.downloadFileName);
|
|
17
97
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
98
|
+
const downloadTableCSV = (0, _react.useCallback)(() => {
|
|
99
|
+
downloadSCSVFile();
|
|
100
|
+
setListDisplay('none');
|
|
101
|
+
}, [queryVariables, table]);
|
|
102
|
+
const downloadTableJson = (0, _react.useCallback)(() => {
|
|
103
|
+
downloadJsonFile();
|
|
104
|
+
setListDisplay('none');
|
|
105
|
+
}, [queryVariables, table]);
|
|
106
|
+
const handleClickButton = () => {
|
|
107
|
+
if (listDisplay === 'none') {
|
|
108
|
+
setListDisplay('block');
|
|
109
|
+
} else {
|
|
110
|
+
setListDisplay('none');
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const useStyles = (0, _core.makeStyles)({
|
|
114
|
+
dropdown: {
|
|
115
|
+
width: '60px',
|
|
116
|
+
height: '25px',
|
|
117
|
+
marginTop: '8px',
|
|
118
|
+
paddingLeft: '5px',
|
|
119
|
+
border: '0.75px solid #606060',
|
|
120
|
+
borderRadius: '5px',
|
|
121
|
+
display: 'inline-block',
|
|
122
|
+
position: 'relative'
|
|
123
|
+
},
|
|
124
|
+
dropdownList: {
|
|
125
|
+
display: 'block',
|
|
126
|
+
position: 'absolute',
|
|
127
|
+
width: '60px',
|
|
128
|
+
marginTop: '3px',
|
|
129
|
+
marginLeft: '-5px',
|
|
130
|
+
overflow: 'auto',
|
|
131
|
+
zIndex: '5',
|
|
132
|
+
border: '1.5px solid #41545E',
|
|
133
|
+
borderRadius: '5px',
|
|
134
|
+
background: '#ffffff'
|
|
135
|
+
},
|
|
136
|
+
dropdownListItem: {
|
|
137
|
+
padding: '2px 4px',
|
|
138
|
+
font: 'Poppins',
|
|
139
|
+
fontSize: '14px',
|
|
140
|
+
fontWeight: 400,
|
|
141
|
+
lineHeight: '21px',
|
|
142
|
+
'&:hover': {
|
|
143
|
+
background: '#D7D7D7',
|
|
144
|
+
cursor: 'pointer'
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
arrowdownIcon: {
|
|
148
|
+
marginLeft: '5px',
|
|
149
|
+
fill: '#606060'
|
|
150
|
+
},
|
|
151
|
+
arrowdownIconDisabled: {
|
|
152
|
+
marginLeft: '5px',
|
|
153
|
+
fill: '#00000042'
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
const classes = useStyles();
|
|
157
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
158
|
+
className: classes.dropdown
|
|
159
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
160
|
+
title: "Download filtered results"
|
|
161
|
+
}, count !== 0 ? /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
162
|
+
onClick: handleClickButton
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null), /*#__PURE__*/_react.default.createElement(_KeyboardArrowDownOutlined.default, {
|
|
164
|
+
className: classes.arrowdownIcon
|
|
165
|
+
})) : /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
166
|
+
disabled: true
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null), /*#__PURE__*/_react.default.createElement(_KeyboardArrowDownOutlined.default, {
|
|
168
|
+
className: classes.arrowdownIconDisabled
|
|
169
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
170
|
+
className: classes.dropdownList,
|
|
171
|
+
style: {
|
|
172
|
+
display: listDisplay
|
|
173
|
+
}
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
+
id: "dropdownListItemCSV",
|
|
176
|
+
className: classes.dropdownListItem,
|
|
177
|
+
onClick: downloadTableCSV
|
|
178
|
+
}, "CSV"), /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
+
id: "dropdownListItemJSON",
|
|
180
|
+
className: classes.dropdownListItem,
|
|
181
|
+
onClick: downloadTableJson
|
|
182
|
+
}, "JSON")));
|
|
21
183
|
};
|
|
22
184
|
var _default = DownloadButton;
|
|
23
185
|
exports.default = _default;
|
|
@@ -28,12 +28,17 @@ const ManageColumnView = _ref => {
|
|
|
28
28
|
const {
|
|
29
29
|
columns
|
|
30
30
|
} = table;
|
|
31
|
-
const viewColumns = columns.filter(col => col.role === _Types.cellTypes.DISPLAY);
|
|
31
|
+
const viewColumns = columns.filter(col => col.role === _Types.cellTypes.DISPLAY && col.hideable);
|
|
32
32
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
33
33
|
title: manageViewColumns.title
|
|
34
34
|
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
35
35
|
variant: "contained",
|
|
36
|
-
onClick: handleClick
|
|
36
|
+
onClick: handleClick,
|
|
37
|
+
style: {
|
|
38
|
+
marginLeft: '10px',
|
|
39
|
+
marginTop: '9px',
|
|
40
|
+
height: '24px'
|
|
41
|
+
}
|
|
37
42
|
}, /*#__PURE__*/_react.default.createElement(_icons.ViewColumn, null))), /*#__PURE__*/_react.default.createElement(_core.Popover, {
|
|
38
43
|
open: open,
|
|
39
44
|
anchorEl: anchorEl,
|
|
@@ -47,7 +52,10 @@ const ManageColumnView = _ref => {
|
|
|
47
52
|
className: "viewColumnText"
|
|
48
53
|
}, manageViewColumns.title), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
49
54
|
onClick: handleClose,
|
|
50
|
-
className: "closeIcon"
|
|
55
|
+
className: "closeIcon",
|
|
56
|
+
style: {
|
|
57
|
+
float: 'right'
|
|
58
|
+
}
|
|
51
59
|
}, /*#__PURE__*/_react.default.createElement(_icons.Close, null)), /*#__PURE__*/_react.default.createElement(_core.List, {
|
|
52
60
|
className: "viewColumnList"
|
|
53
61
|
}, viewColumns.map(column => /*#__PURE__*/_react.default.createElement(_core.ListItem, {
|
package/dist/util/Dataformat.js
CHANGED
|
@@ -4,6 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.formatBytes = formatBytes;
|
|
7
|
+
exports.formatColumnValues = void 0;
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
7
13
|
/* eslint-disable import/prefer-default-export */
|
|
8
14
|
function formatBytes(bytes) {
|
|
9
15
|
let decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
@@ -12,4 +18,38 @@ function formatBytes(bytes) {
|
|
|
12
18
|
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
13
19
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
14
20
|
return "".concat(parseFloat((bytes / 1024 ** i).toFixed(dm)), " ").concat(sizes[i]);
|
|
15
|
-
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* convert zero (0) value to custom val
|
|
25
|
+
* @param {*} columns
|
|
26
|
+
* @param {*} data
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
const formatColumnValues = (columns, data) => {
|
|
30
|
+
const formatColumns = columns.filter(_ref => {
|
|
31
|
+
let {
|
|
32
|
+
columnDefaultValues
|
|
33
|
+
} = _ref;
|
|
34
|
+
return columnDefaultValues;
|
|
35
|
+
});
|
|
36
|
+
if (formatColumns.length > 0) {
|
|
37
|
+
const formatCoumnData = [...data].reduce((acc, item) => {
|
|
38
|
+
const updateRow = _objectSpread({}, item);
|
|
39
|
+
formatColumns.forEach(col => {
|
|
40
|
+
const {
|
|
41
|
+
columnDefaultValues,
|
|
42
|
+
dataField
|
|
43
|
+
} = col;
|
|
44
|
+
if (columnDefaultValues[item[dataField]]) {
|
|
45
|
+
updateRow[dataField] = columnDefaultValues[item[dataField]];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
acc.push(updateRow);
|
|
49
|
+
return acc;
|
|
50
|
+
}, []);
|
|
51
|
+
return formatCoumnData;
|
|
52
|
+
}
|
|
53
|
+
return data;
|
|
54
|
+
};
|
|
55
|
+
exports.formatColumnValues = formatColumnValues;
|
package/dist/util/Types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.actionCellTypes = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.CHECKBOX = void 0;
|
|
6
|
+
exports.notIncludedCellStyle = exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.cellStyles = exports.actionCellTypes = exports.TRANSFORM = exports.STUDY_DOWNLOAD = exports.LINK = exports.FORMAT_DATA_CELLS = exports.FORMAT_DATA = exports.FORMAT_BYTES = exports.EXPAND = exports.DISPLAY = exports.DELETE = exports.DEFAULT = exports.DBGAP = exports.ComponentTypes = exports.CUSTOM_ELEM = exports.CPI = exports.CHECKBOX = void 0;
|
|
7
7
|
const CHECKBOX = 'CHECKBOX';
|
|
8
8
|
exports.CHECKBOX = CHECKBOX;
|
|
9
9
|
const DELETE = 'DELETE';
|
|
@@ -18,8 +18,18 @@ const DEFAULT = 'DEFAULT';
|
|
|
18
18
|
exports.DEFAULT = DEFAULT;
|
|
19
19
|
const FORMAT_DATA = 'FORMAT_DATA';
|
|
20
20
|
exports.FORMAT_DATA = FORMAT_DATA;
|
|
21
|
+
const CPI = 'CPI';
|
|
22
|
+
exports.CPI = CPI;
|
|
21
23
|
const FORMAT_BYTES = 'FORMAT_BYTES';
|
|
22
24
|
exports.FORMAT_BYTES = FORMAT_BYTES;
|
|
25
|
+
const TRANSFORM = 'TRANSFORM';
|
|
26
|
+
exports.TRANSFORM = TRANSFORM;
|
|
27
|
+
const STUDY_DOWNLOAD = 'STUDY_DOWNLOAD';
|
|
28
|
+
exports.STUDY_DOWNLOAD = STUDY_DOWNLOAD;
|
|
29
|
+
const EXPAND = 'EXPAND';
|
|
30
|
+
exports.EXPAND = EXPAND;
|
|
31
|
+
const DBGAP = 'DBGAP';
|
|
32
|
+
exports.DBGAP = DBGAP;
|
|
23
33
|
const cellTypes = {
|
|
24
34
|
CUSTOM_ELEM,
|
|
25
35
|
LINK,
|
|
@@ -27,11 +37,21 @@ const cellTypes = {
|
|
|
27
37
|
CHECKBOX,
|
|
28
38
|
DELETE,
|
|
29
39
|
DEFAULT,
|
|
30
|
-
FORMAT_DATA
|
|
40
|
+
FORMAT_DATA,
|
|
41
|
+
CPI
|
|
31
42
|
};
|
|
32
43
|
exports.cellTypes = cellTypes;
|
|
44
|
+
const cellStyles = {
|
|
45
|
+
TRANSFORM,
|
|
46
|
+
EXPAND,
|
|
47
|
+
DBGAP,
|
|
48
|
+
STUDY_DOWNLOAD
|
|
49
|
+
};
|
|
50
|
+
exports.cellStyles = cellStyles;
|
|
33
51
|
const actionCellTypes = [CHECKBOX, DELETE];
|
|
34
52
|
exports.actionCellTypes = actionCellTypes;
|
|
53
|
+
const notIncludedCellStyle = [STUDY_DOWNLOAD];
|
|
54
|
+
exports.notIncludedCellStyle = notIncludedCellStyle;
|
|
35
55
|
const FORMAT_DATA_CELLS = [FORMAT_BYTES];
|
|
36
56
|
exports.FORMAT_DATA_CELLS = FORMAT_DATA_CELLS;
|
|
37
57
|
const dataFormatTypes = {
|
|
@@ -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
|
+
}
|