@bento-core/paginated-table 1.0.1-ccdiintegrated.4 → 1.0.1-ccdiintegrated.5

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.
@@ -26,12 +26,7 @@ const PaginatedTable = _ref => {
26
26
  initState,
27
27
  activeTab = true,
28
28
  server = true,
29
- tblRows = [],
30
- navigation = () => {},
31
- onSearch,
32
- searchValue,
33
- onSearchResultCount,
34
- onColumnStateChange
29
+ tblRows = []
35
30
  } = _ref;
36
31
  /**
37
32
  * Initailize useReducer state
@@ -40,6 +35,11 @@ const PaginatedTable = _ref => {
40
35
  * 3. Add all btn / Add file button also dispatch action to update table state
41
36
  */
42
37
  const [table, dispatch] = (0, _react.useReducer)(_Reducer.default, {}, initState);
38
+ (0, _react.useEffect)(() => {
39
+ if (Object.keys(queryVariables).length > 0) {
40
+ dispatch((0, _Actions.unselectAllRows)());
41
+ }
42
+ }, [queryVariables]);
43
43
 
44
44
  /**
45
45
  * use context to provide table state to wrapper component
@@ -186,10 +186,6 @@ const PaginatedTable = _ref => {
186
186
  dispatch((0, _Actions.onColumnViewChange)(_objectSpread(_objectSpread({}, table), {}, {
187
187
  columns
188
188
  })));
189
- // Save column state for persistence across search state changes
190
- if (onColumnStateChange) {
191
- onColumnStateChange(columns);
192
- }
193
189
  };
194
190
  const handleAllColumnViewChange = checked => {
195
191
  const columns = table.columns.map(col => {
@@ -203,10 +199,6 @@ const PaginatedTable = _ref => {
203
199
  dispatch((0, _Actions.onColumnViewChange)(_objectSpread(_objectSpread({}, table), {}, {
204
200
  columns
205
201
  })));
206
- // Save column state for persistence across search state changes
207
- if (onColumnStateChange) {
208
- onColumnStateChange(columns);
209
- }
210
202
  };
211
203
  /**
212
204
  * A. client table
@@ -224,10 +216,7 @@ const PaginatedTable = _ref => {
224
216
  onSortByColumn: handleSortByColumn,
225
217
  onColumnViewChange: handleColumnViewChange,
226
218
  onAllColumnViewChange: handleAllColumnViewChange,
227
- themeConfig: themeConfig,
228
- onSearch: onSearch,
229
- searchValue: searchValue,
230
- onSearchResultCount: onSearchResultCount
219
+ themeConfig: themeConfig
231
220
  }));
232
221
  }
233
222
 
@@ -252,11 +241,7 @@ const PaginatedTable = _ref => {
252
241
  onSortByColumn: handleSortByColumn,
253
242
  onColumnViewChange: handleColumnViewChange,
254
243
  onAllColumnViewChange: handleAllColumnViewChange,
255
- themeConfig: themeConfig,
256
- navigation: navigation,
257
- onSearch: onSearch,
258
- searchValue: searchValue,
259
- onSearchResultCount: onSearchResultCount
244
+ themeConfig: themeConfig
260
245
  }));
261
246
  };
262
247
  var _default = PaginatedTable;
@@ -16,15 +16,13 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
16
16
  const TableController = props => {
17
17
  const {
18
18
  queryVariables,
19
- table,
20
- onSearchResultCount
19
+ table
21
20
  } = props;
22
21
  const {
23
22
  tableData
24
23
  } = (0, _TableService.getTableData)({
25
24
  queryVariables,
26
- table,
27
- onSearchResultCount
25
+ table
28
26
  });
29
27
  if (!tableData) {
30
28
  return /*#__PURE__*/_react.default.createElement(_core.Container, {
@@ -58,14 +58,12 @@ const getPaginatedQueryVariables = (queryVariables, table) => {
58
58
  * @param {*} queryVariables
59
59
  * @param {*} table (table state)
60
60
  * @param {*} tab (tab)
61
- * @param {*} onSearchResultCount (callback to update search result count)
62
61
  * @returns table data
63
62
  */
64
63
  const getTableData = _ref => {
65
64
  let {
66
65
  queryVariables,
67
- table,
68
- onSearchResultCount
66
+ table
69
67
  } = _ref;
70
68
  const client = (0, _client.useApolloClient)();
71
69
  const {
@@ -88,26 +86,7 @@ const getTableData = _ref => {
88
86
  const controller = new AbortController();
89
87
  getData().then(result => {
90
88
  if (table.paginationAPIField && result[table.paginationAPIField]) {
91
- const apiResult = result[table.paginationAPIField];
92
-
93
- // Check if this is the new getFilenames structure with files and totalCount
94
- if (apiResult && typeof apiResult === 'object' && 'files' in apiResult && 'totalCount' in apiResult) {
95
- // Handle getFilenames response structure
96
- setTableData(apiResult.files);
97
-
98
- // Update total count for search results
99
- if (onSearchResultCount && apiResult.totalCount !== undefined) {
100
- onSearchResultCount(apiResult.totalCount);
101
- }
102
- } else {
103
- // Handle regular array response (fileOverview, etc.)
104
- setTableData(apiResult);
105
-
106
- // For non-search queries, don't update the count
107
- if (onSearchResultCount) {
108
- onSearchResultCount(null);
109
- }
110
- }
89
+ setTableData(result[table.paginationAPIField]);
111
90
  } else {
112
91
  setTableData(result);
113
92
  }
@@ -116,7 +95,7 @@ const getTableData = _ref => {
116
95
  // cancel the request before component unmounts
117
96
  controller.abort();
118
97
  };
119
- }, [queryVariables, page, rowsPerPage, sortOrder, sortBy, query, table.paginationAPIField]);
98
+ }, [queryVariables, page, rowsPerPage, sortOrder, sortBy]);
120
99
  return {
121
100
  tableData
122
101
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSelectHidden = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.actionTypes = void 0;
6
+ exports.unselectAllRows = exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSelectHidden = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.actionTypes = void 0;
7
7
  const actionTypes = {
8
8
  VIEW_COLUMN_CHANGE: 'VIEW_COLUMN_CHANGE',
9
9
  ON_COLUMN_SORT: 'ON_COLUMN_SORT',
@@ -13,7 +13,8 @@ const actionTypes = {
13
13
  ON_ROW_SELECT: 'ON_ROW_SELECT',
14
14
  ON_ROW_SELECT_HIDDEN: 'ON_ROW_SELECT_HIDDEN',
15
15
  SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
16
- ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE'
16
+ ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
17
+ UNSELECT_ALL_ROWS: 'UNSELECT_ALL_ROWS'
17
18
  };
18
19
  exports.actionTypes = actionTypes;
19
20
  const onColumnViewChange = columns => ({
@@ -60,4 +61,8 @@ const setTotalRowCount = count => ({
60
61
  type: actionTypes.SET_TOTAL_ROW_COUNT,
61
62
  payload: count
62
63
  });
63
- exports.setTotalRowCount = setTotalRowCount;
64
+ exports.setTotalRowCount = setTotalRowCount;
65
+ const unselectAllRows = () => ({
66
+ type: actionTypes.UNSELECT_ALL_ROWS
67
+ });
68
+ exports.unselectAllRows = unselectAllRows;
@@ -49,6 +49,11 @@ const reducer = (state, action) => {
49
49
  return _objectSpread(_objectSpread({}, state), {}, {
50
50
  totalRowCount: payload
51
51
  });
52
+ case _Actions.actionTypes.UNSELECT_ALL_ROWS:
53
+ return _objectSpread(_objectSpread({}, state), {}, {
54
+ selectedRows: [],
55
+ hiddenSelectedRows: []
56
+ });
52
57
  default:
53
58
  return state;
54
59
  }
@@ -78,10 +78,8 @@ const Text = _ref2 => {
78
78
  const ViewComponent = props => {
79
79
  const {
80
80
  type,
81
- customViewElem,
82
- CohortViewElem,
83
- tooltipCofig,
84
- section
81
+ CustomViewElem,
82
+ tooltipCofig
85
83
  } = props;
86
84
  switch (type) {
87
85
  case types.BUTTON:
@@ -95,12 +93,7 @@ const ViewComponent = props => {
95
93
  case types.TEXT_INPUT:
96
94
  return /*#__PURE__*/_react.default.createElement(_TextFieldView.default, props);
97
95
  case types.CUSTOM_ELEM:
98
- return customViewElem();
99
- case types.COHORT_ELEM:
100
- if (section !== 'Participants') {
101
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
102
- }
103
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CohortViewElem, null), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props));
96
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CustomViewElem, null), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props));
104
97
  default:
105
98
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
106
99
  }
@@ -14,7 +14,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
14
14
  */
15
15
  const getQueryVariables = variables => {
16
16
  const queryVariables = _objectSpread({}, variables);
17
- queryVariables.first = 200000;
17
+ queryVariables.first = 100000;
18
18
  return queryVariables;
19
19
  };
20
20
  exports.getQueryVariables = getQueryVariables;
@@ -40,18 +40,16 @@ const ToolTipView = props => {
40
40
  alt: alt
41
41
  }));
42
42
  };
43
-
44
- // const checkDuplicate = (cartFiles, ids) => {
45
- // const newIds = [];
46
- // for (let i = 0; i < ids.length; i += 1) {
47
- // if (!cartFiles.includes(ids[i])) {
48
- // newIds.push(ids[i]);
49
- // }
50
- // }
51
- // return newIds;
52
- // };
53
43
  exports.ToolTipView = ToolTipView;
54
- const checkDuplicate = (cartFiles, ids) => ids.filter(id => !cartFiles[id]);
44
+ const checkDuplicate = (cartFiles, ids) => {
45
+ let duplicateCount = 0;
46
+ for (let i = 0; i < cartFiles.length; i += 1) {
47
+ if (ids.includes(cartFiles[i])) {
48
+ duplicateCount += 1;
49
+ }
50
+ }
51
+ return duplicateCount;
52
+ };
55
53
  const AddAllFilesComponent = props => {
56
54
  const {
57
55
  title,
@@ -74,16 +72,6 @@ const AddAllFilesComponent = props => {
74
72
  const [openAddDialog, setOpen] = (0, _react.useState)(false);
75
73
  const toggleOpen = () => setOpen(!openAddDialog);
76
74
  const [addFilesId, setAddFilesId] = (0, _react.useState)([]);
77
- const [isDataloading, setIsDataloading] = (0, _react.useState)(false);
78
- const cartFilesDict = {};
79
- cartFiles.forEach(file => {
80
- cartFilesDict[file] = true;
81
- });
82
- const backdropCls = {
83
- width: '100%',
84
- zIndex: 99999,
85
- background: 'rgba(0, 0, 0, 0.1)'
86
- };
87
75
 
88
76
  /**
89
77
  * verify and set file ids
@@ -94,42 +82,29 @@ const AddAllFilesComponent = props => {
94
82
  variables: activeFilters,
95
83
  query: addFileQuery
96
84
  });
97
- const upperLimit = 200000;
98
85
  const cartCount = cartFiles.length;
99
- if (fileCount <= upperLimit && cartCount < upperLimit) {
100
- setIsDataloading(true);
86
+ if (fileCount <= 6000 && cartCount < 6000) {
101
87
  fileIds().then(response => {
102
88
  const data = response[responseKeys[0]];
103
89
  if (data && data.length > 0) {
104
90
  const isArray = Array.isArray(data[0][responseKeys[1]]);
105
- // const idsInitial = data.reduce((acc, id) => {
106
- // if (id && id[responseKeys[1]]) {
107
- // // if object convert to array
108
- // const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
109
- // acc.push(...items);
110
- // }
111
- // return acc;
112
- // }, []);
113
- const idsInitial = [];
114
- data.forEach(item => {
115
- if (item && item[responseKeys[1]]) {
116
- const items = isArray ? item[responseKeys[1]] : [item[responseKeys[1]]];
117
- items.forEach(it => {
118
- idsInitial.push(it);
119
- });
91
+ const idsInitial = data.reduce((acc, id) => {
92
+ if (id && id[responseKeys[1]]) {
93
+ // if object convert to array
94
+ const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
95
+ acc.push(...items);
120
96
  }
121
- });
97
+ return acc;
98
+ }, []);
122
99
  const ids = [...new Set(idsInitial)];
123
- if (cartCount + ids.length <= upperLimit) {
124
- setIsDataloading(false);
125
- addFiles(ids);
126
- setOpenSnackbar(true);
100
+ if (cartCount + ids.length <= 6000) {
101
+ setOpen(true);
102
+ setAddFilesId(ids);
127
103
  } else {
128
- const newIds = checkDuplicate(cartFilesDict, ids);
129
- setIsDataloading(false);
130
- if (cartCount + newIds.length <= upperLimit) {
104
+ const duplicate = checkDuplicate(cartFiles, ids);
105
+ if (cartCount + ids.length - duplicate <= 6000) {
131
106
  setOpen(true);
132
- setAddFilesId(newIds);
107
+ setAddFilesId(ids);
133
108
  } else {
134
109
  setAlterDisplay(true);
135
110
  }
@@ -158,13 +133,7 @@ const AddAllFilesComponent = props => {
158
133
  open: openAddDialog,
159
134
  onYesClick: addFilesToCart,
160
135
  onNoClick: toggleOpen
161
- }), /*#__PURE__*/_react.default.createElement(_core.Backdrop, {
162
- className: backdropCls,
163
- style: backdropCls,
164
- open: isDataloading
165
- }, /*#__PURE__*/_react.default.createElement(_core.CircularProgress, {
166
- color: "inherit"
167
- })));
136
+ }));
168
137
  };
169
138
  var _default = AddAllFilesComponent;
170
139
  exports.default = _default;
@@ -61,15 +61,14 @@ const AddSelectedFilesController = props => {
61
61
  const idsInitial = response[responseKeys[0]] || [];
62
62
  const ids = [...new Set(idsInitial)];
63
63
  const fileCount = ids.length;
64
- const upperLimit = 200000;
65
- if (fileCount <= upperLimit && cartCount < upperLimit) {
66
- if (cartCount + fileCount <= upperLimit) {
64
+ if (fileCount <= 6000 && cartCount < 6000) {
65
+ if (cartCount + fileCount <= 6000) {
67
66
  addFiles(ids);
68
67
  setOpenSnackbar(true);
69
68
  dispatch((0, _Actions.onRowSeclect)([]));
70
69
  } else {
71
70
  const duplicate = checkDuplicate(cartFiles, ids);
72
- if (cartCount + fileCount - duplicate <= upperLimit) {
71
+ if (cartCount + fileCount - duplicate <= 6000) {
73
72
  addFiles(ids);
74
73
  setOpenSnackbar(true);
75
74
  dispatch((0, _Actions.onRowSeclect)([]));
@@ -37,7 +37,7 @@ const DownloadManifestView = props => {
37
37
  const getQueryVeriables = queryVariables => {
38
38
  const variables = _objectSpread({}, queryVariables);
39
39
  variables.offset = 0;
40
- variables.first = 200000;
40
+ variables.first = 10000;
41
41
  return variables;
42
42
  };
43
43
  const client = (0, _client.useApolloClient)();
@@ -24,8 +24,8 @@ const SnackbarView = props => {
24
24
  open: open,
25
25
  autoHideDuration: 3000,
26
26
  anchorOrigin: {
27
- vertical: 'top',
28
- horizontal: 'center'
27
+ vertical: 'bottom',
28
+ horizontal: 'right'
29
29
  },
30
30
  message: /*#__PURE__*/_react.default.createElement("div", {
31
31
  className: "snackBarMessage"
@@ -21,11 +21,13 @@ const ToolTipView = props => {
21
21
  icon,
22
22
  alt,
23
23
  arrow = false,
24
+ maxWidth,
24
25
  clsName
25
26
  } = tooltipCofig;
26
27
  return /*#__PURE__*/_react.default.createElement(_toolTip.default, {
27
28
  title: tooltipCofig[section],
28
29
  arrow: arrow,
30
+ maxWidth: maxWidth || '230px',
29
31
  classes: {
30
32
  tooltip: classes.customTooltip,
31
33
  arrow: classes.customArrow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-ccdiintegrated.4",
3
+ "version": "1.0.1-ccdiintegrated.5",
4
4
  "homepage": "https://github.com/CBIIT/bento-frontend#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/CBIIT/bento-frontend/issues"
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@bento-core/cart": "1.0.1-ccdiintegrated.1",
23
- "@bento-core/table": "1.0.1-ccdiintegrated.4",
23
+ "@bento-core/table": "1.0.1-ccdiintegrated.5",
24
24
  "@bento-core/tool-tip": "1.0.1-ccdiintegrated.1",
25
25
  "@bento-core/util": "1.0.1-ccdiintegrated.1"
26
26
  },