@bento-core/table 1.0.1-ccdihub.68 → 1.0.1-ccdihub.69

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.headerTypes = exports.dataFormatTypes = exports.cellTypes = exports.cellStyles = exports.actionCellTypes = exports.TRANSFORM = 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.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.CHECKBOX = void 0;
7
7
  const CHECKBOX = 'CHECKBOX';
8
8
  exports.CHECKBOX = CHECKBOX;
9
9
  const DELETE = 'DELETE';
@@ -22,6 +22,8 @@ const FORMAT_BYTES = 'FORMAT_BYTES';
22
22
  exports.FORMAT_BYTES = FORMAT_BYTES;
23
23
  const TRANSFORM = 'TRANSFORM';
24
24
  exports.TRANSFORM = TRANSFORM;
25
+ const STUDY_DOWNLOAD = 'STUDY_DOWNLOAD';
26
+ exports.STUDY_DOWNLOAD = STUDY_DOWNLOAD;
25
27
  const EXPAND = 'EXPAND';
26
28
  exports.EXPAND = EXPAND;
27
29
  const DBGAP = 'DBGAP';
@@ -39,11 +41,14 @@ exports.cellTypes = cellTypes;
39
41
  const cellStyles = {
40
42
  TRANSFORM,
41
43
  EXPAND,
42
- DBGAP
44
+ DBGAP,
45
+ STUDY_DOWNLOAD
43
46
  };
44
47
  exports.cellStyles = cellStyles;
45
48
  const actionCellTypes = [CHECKBOX, DELETE];
46
49
  exports.actionCellTypes = actionCellTypes;
50
+ const notIncludedCellStyle = [STUDY_DOWNLOAD];
51
+ exports.notIncludedCellStyle = notIncludedCellStyle;
47
52
  const FORMAT_DATA_CELLS = [FORMAT_BYTES];
48
53
  exports.FORMAT_DATA_CELLS = FORMAT_DATA_CELLS;
49
54
  const dataFormatTypes = {
@@ -79,30 +79,35 @@ function downloadCSV(tableData, table, downloadFileName) {
79
79
  cellType
80
80
  } = _ref;
81
81
  return !_Types.actionCellTypes.includes(cellType);
82
+ }).filter(_ref2 => {
83
+ let {
84
+ cellStyle
85
+ } = _ref2;
86
+ return !_Types.notIncludedCellStyle.includes(cellStyle);
82
87
  });
83
88
  const formatDataVal = (0, _Dataformat.formatColumnValues)(filterColumns, tableData);
84
89
  const jsonse = JSON.stringify(formatDataVal);
85
- const keysToInclude = columns.filter(_ref2 => {
90
+ const keysToInclude = filterColumns.filter(_ref3 => {
86
91
  let {
87
92
  dataField
88
- } = _ref2;
93
+ } = _ref3;
89
94
  return dataField;
90
- }).map(_ref3 => {
95
+ }).map(_ref4 => {
91
96
  let {
92
97
  dataField
93
- } = _ref3;
98
+ } = _ref4;
94
99
  return dataField;
95
100
  });
96
- const headers = columns.filter(_ref4 => {
101
+ const headers = filterColumns.filter(_ref5 => {
97
102
  let {
98
103
  dataField
99
- } = _ref4;
104
+ } = _ref5;
100
105
  return dataField;
101
- }).map(_ref5 => {
106
+ }).map(_ref6 => {
102
107
  let {
103
108
  header,
104
109
  downloadHeader
105
- } = _ref5;
110
+ } = _ref6;
106
111
  return downloadHeader || header;
107
112
  });
108
113
  const csv = convertToCSV(jsonse, keysToInclude, headers);
@@ -122,10 +127,10 @@ function downloadJson(tableData, table, downloadFileName) {
122
127
  const {
123
128
  columns = []
124
129
  } = table;
125
- const filterColumns = columns.filter(_ref6 => {
130
+ const filterColumns = columns.filter(_ref7 => {
126
131
  let {
127
132
  cellType
128
- } = _ref6;
133
+ } = _ref7;
129
134
  return !_Types.actionCellTypes.includes(cellType);
130
135
  });
131
136
  let formatDataVal = (0, _Dataformat.formatColumnValues)(filterColumns, tableData);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ccdihub.68",
3
+ "version": "1.0.1-ccdihub.69",
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",
package/src/util/Types.js CHANGED
@@ -7,6 +7,7 @@ export const DEFAULT = 'DEFAULT';
7
7
  export const FORMAT_DATA = 'FORMAT_DATA';
8
8
  export const FORMAT_BYTES = 'FORMAT_BYTES';
9
9
  export const TRANSFORM = 'TRANSFORM';
10
+ export const STUDY_DOWNLOAD = 'STUDY_DOWNLOAD';
10
11
  export const EXPAND = 'EXPAND';
11
12
  export const DBGAP = 'DBGAP';
12
13
 
@@ -24,10 +25,13 @@ export const cellStyles = {
24
25
  TRANSFORM,
25
26
  EXPAND,
26
27
  DBGAP,
28
+ STUDY_DOWNLOAD,
27
29
  };
28
30
 
29
31
  export const actionCellTypes = [CHECKBOX, DELETE];
30
32
 
33
+ export const notIncludedCellStyle = [STUDY_DOWNLOAD];
34
+
31
35
  export const FORMAT_DATA_CELLS = [FORMAT_BYTES];
32
36
 
33
37
  export const dataFormatTypes = {
@@ -1,5 +1,5 @@
1
1
  import { formatBytes, formatColumnValues } from './Dataformat';
2
- import { actionCellTypes } from './Types';
2
+ import { actionCellTypes, notIncludedCellStyle } from './Types';
3
3
 
4
4
  export function createFileName(fileName, type) {
5
5
  const date = new Date();
@@ -64,12 +64,13 @@ export function convertToCSV(jsonse, keysToInclude, header) {
64
64
 
65
65
  export function downloadCSV(tableData, table, downloadFileName) {
66
66
  const { columns = [] } = table;
67
- const filterColumns = columns.filter(({ cellType }) => !actionCellTypes.includes(cellType));
67
+ const filterColumns = columns.filter(({ cellType }) => !actionCellTypes.includes(cellType))
68
+ .filter(({ cellStyle }) => !notIncludedCellStyle.includes(cellStyle));
68
69
  const formatDataVal = formatColumnValues(filterColumns, tableData);
69
70
  const jsonse = JSON.stringify(formatDataVal);
70
- const keysToInclude = columns.filter(({ dataField }) => dataField)
71
+ const keysToInclude = filterColumns.filter(({ dataField }) => dataField)
71
72
  .map(({ dataField }) => dataField);
72
- const headers = columns.filter(({ dataField }) => dataField)
73
+ const headers = filterColumns.filter(({ dataField }) => dataField)
73
74
  .map(({ header, downloadHeader }) => (downloadHeader || header));
74
75
  const csv = convertToCSV(jsonse, keysToInclude, headers);
75
76
  const exportData = new Blob([csv], { type: 'text/csv' });