@bento-core/table 1.0.1-ccdihub.113 → 1.0.1-ccdihub.114

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.
@@ -228,10 +228,13 @@ const CPIModal = _ref => {
228
228
  const dropdownRef = (0, _react.useRef)(null);
229
229
  const participantId = row.participant_id;
230
230
  const studyId = row.study_id;
231
- const cpiData = row.cpi_data;
232
231
  (0, _react.useEffect)(() => {
233
- setData(row.cpi_data);
234
- }, [row]);
232
+ // Reset all state when row or open status changes
233
+ setData(row.cpi_data || []);
234
+ setIds([]);
235
+ setSelectAll(false);
236
+ setDropdownOpen(false);
237
+ }, [row, open]);
235
238
  const handleDropdownToggle = () => {
236
239
  setDropdownOpen(!dropdownOpen);
237
240
  };
@@ -299,7 +302,7 @@ const CPIModal = _ref => {
299
302
  size: 'xl',
300
303
  clsName: 'container_header',
301
304
  items: [{
302
- participantIds: cpiData,
305
+ participantIds: data,
303
306
  title: 'ADD ALL FILES FOR PARTICIPANT',
304
307
  clsName: 'add_all_button',
305
308
  role: 'ADD_ALL_FILES',
@@ -94,6 +94,7 @@ const CPIView = _ref => {
94
94
  return /*#__PURE__*/_react.default.createElement(_core.Typography, {
95
95
  className: _Types.cellTypes.CPI
96
96
  }, row[column === null || column === void 0 ? void 0 : column.dataField], cpiData.length ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CPIModal.default, {
97
+ key: "".concat(row.id, "-").concat(row.participant_id),
97
98
  row: row,
98
99
  open: modalOpen,
99
100
  onClose: handleModalClose,
@@ -107,6 +107,8 @@ const CPIFilesComponent = props => {
107
107
  */
108
108
  const addAllFiles = () => {
109
109
  let toAdd = [];
110
+ console.log('participantIds', participantIds);
111
+ console.log('rowID', rowID);
110
112
  if (btnType === 'ADD_ALL_FILES') {
111
113
  participantIds.forEach(e => {
112
114
  if (e.data_type === 'internal' && e.p_id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/table",
3
- "version": "1.0.1-ccdihub.113",
3
+ "version": "1.0.1-ccdihub.114",
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",
@@ -235,11 +235,14 @@ const CPIModal = ({
235
235
 
236
236
  const participantId = row.participant_id;
237
237
  const studyId = row.study_id;
238
- const cpiData = row.cpi_data;
239
238
 
240
239
  useEffect(() => {
241
- setData(row.cpi_data);
242
- }, [row]);
240
+ // Reset all state when row or open status changes
241
+ setData(row.cpi_data || []);
242
+ setIds([]);
243
+ setSelectAll(false);
244
+ setDropdownOpen(false);
245
+ }, [row, open]);
243
246
 
244
247
  const handleDropdownToggle = () => {
245
248
  setDropdownOpen(!dropdownOpen);
@@ -319,7 +322,7 @@ const CPIModal = ({
319
322
  clsName: 'container_header',
320
323
  items: [
321
324
  {
322
- participantIds: cpiData,
325
+ participantIds: data,
323
326
  title: 'ADD ALL FILES FOR PARTICIPANT',
324
327
  clsName: 'add_all_button',
325
328
  role: 'ADD_ALL_FILES',
@@ -102,6 +102,7 @@ const CPIView = ({
102
102
  ? (
103
103
  <>
104
104
  <CPIModal
105
+ key={`${row.id}-${row.participant_id}`}
105
106
  row={row}
106
107
  open={modalOpen}
107
108
  onClose={handleModalClose}
@@ -109,6 +109,8 @@ const CPIFilesComponent = (props) => {
109
109
  */
110
110
  const addAllFiles = () => {
111
111
  let toAdd = [];
112
+ console.log('participantIds', participantIds);
113
+ console.log('rowID', rowID);
112
114
  if (btnType === 'ADD_ALL_FILES') {
113
115
  participantIds.forEach((e) => {
114
116
  if (e.data_type === 'internal' && e.p_id) {