@bento-core/table 1.0.1-ccdihub.99 → 1.0.1-ccdiintegrated.10

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.
Files changed (75) hide show
  1. package/dist/ExtendedView.js +135 -8
  2. package/dist/TableView.js +25 -7
  3. package/dist/body/CustomTblBody.js +2 -1
  4. package/dist/body/DefaultThemConfig.js +1 -1
  5. package/dist/body/DisplayBodyCell.js +24 -2
  6. package/dist/body/components/CPIMappingView.js +221 -0
  7. package/dist/body/components/CPIModal.js +440 -94
  8. package/dist/body/components/CPIView.js +64 -10
  9. package/dist/body/components/CustomLinkView.js +2 -1
  10. package/dist/body/components/DataFormatView.js +1 -1
  11. package/dist/body/components/StudiesDataAvailabilityView.js +125 -0
  12. package/dist/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  13. package/dist/body/components/assets/CPI_Icon_Multi.svg +6 -0
  14. package/dist/body/components/assets/CPI_Icon_Single.svg +4 -0
  15. package/dist/body/components/assets/CPI_Icon_Study.svg +11 -0
  16. package/dist/body/components/assets/Participant_Files.svg +17 -0
  17. package/dist/body/components/assets/Publications.svg +15 -0
  18. package/dist/body/components/assets/Sample_Files.svg +16 -0
  19. package/dist/body/components/assets/Study_Files.svg +21 -0
  20. package/dist/body/components/assets/download.svg +3 -0
  21. package/dist/header/CustomCell.js +4 -3
  22. package/dist/header/CustomTblHeader.js +16 -3
  23. package/dist/index.js +25 -0
  24. package/dist/toolbar/DownloadButtonView.js +30 -4
  25. package/dist/toolbar/SearchBar.js +92 -0
  26. package/dist/toolbar/assets/Search_Icon.svg +3 -0
  27. package/dist/util/Dataformat.js +50 -2
  28. package/dist/util/Types.js +16 -4
  29. package/dist/util/downloadTable.js +77 -53
  30. package/dist/wrapper/components/AddFiles.js +6 -14
  31. package/dist/wrapper/components/AddToCart/AddToCartView.js +128 -0
  32. package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +28 -0
  33. package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +12 -6
  34. package/dist/wrapper/components/ReduxAddFile.js +1 -0
  35. package/dist/wrapper/components/Snackbar/CartToast.js +96 -0
  36. package/dist/wrapper/components/Snackbar/Snackbar.js +12 -1
  37. package/dist/wrapper/components/Snackbar/SnackbarRedux.js +2 -1
  38. package/package.json +23 -22
  39. package/src/ExtendedView.js +147 -8
  40. package/src/TableView.js +29 -8
  41. package/src/body/CustomTblBody.js +2 -1
  42. package/src/body/DefaultThemConfig.js +1 -1
  43. package/src/body/DisplayBodyCell.js +40 -2
  44. package/src/body/components/CPIMappingView.js +260 -0
  45. package/src/body/components/CPIModal.js +468 -101
  46. package/src/body/components/CPIView.js +75 -22
  47. package/src/body/components/CustomLinkView.js +4 -1
  48. package/src/body/components/DataFormatView.js +4 -2
  49. package/src/body/components/StudiesDataAvailabilityView.js +121 -0
  50. package/src/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  51. package/src/body/components/assets/CPI_Icon_Multi.svg +6 -0
  52. package/src/body/components/assets/CPI_Icon_Single.svg +4 -0
  53. package/src/body/components/assets/CPI_Icon_Study.svg +11 -0
  54. package/src/body/components/assets/Participant_Files.svg +17 -0
  55. package/src/body/components/assets/Publications.svg +15 -0
  56. package/src/body/components/assets/Sample_Files.svg +16 -0
  57. package/src/body/components/assets/Study_Files.svg +21 -0
  58. package/src/body/components/assets/download.svg +3 -0
  59. package/src/header/CustomCell.js +4 -3
  60. package/src/header/CustomTblHeader.js +13 -1
  61. package/src/index.js +7 -1
  62. package/src/toolbar/DownloadButtonView.js +20 -4
  63. package/src/toolbar/SearchBar.js +90 -0
  64. package/src/toolbar/assets/Search_Icon.svg +3 -0
  65. package/src/util/Dataformat.js +47 -0
  66. package/src/util/Types.js +10 -1
  67. package/src/util/downloadTable.js +75 -34
  68. package/src/wrapper/components/AddFiles.js +7 -14
  69. package/src/wrapper/components/AddToCart/AddToCartView.js +134 -0
  70. package/src/wrapper/components/AddToCart/ReduxAddToCart.js +21 -0
  71. package/src/wrapper/components/CPIFilesView/CPIFilesView.js +15 -9
  72. package/src/wrapper/components/ReduxAddFile.js +1 -0
  73. package/src/wrapper/components/Snackbar/CartToast.js +99 -0
  74. package/src/wrapper/components/Snackbar/Snackbar.js +8 -3
  75. package/src/wrapper/components/Snackbar/SnackbarRedux.js +2 -1
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _core = require("@material-ui/core");
9
+ var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
9
10
  var _CustomPagination = _interopRequireDefault(require("./pagination/CustomPagination"));
10
11
  var _ManageColumnView = _interopRequireDefault(require("./toolbar/ManageColumnView"));
11
12
  var _DefaultThemConfig = _interopRequireDefault(require("./DefaultThemConfig"));
12
13
  var _DownloadButtonView = _interopRequireDefault(require("./toolbar/DownloadButtonView"));
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ 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); }
16
+ 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; }
14
17
  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; }
15
18
  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; }
16
19
  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; }
@@ -18,8 +21,49 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
18
21
  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); }
19
22
  const downloadAreaStyle = {
20
23
  display: 'flex',
21
- borderTop: '1px solid #8A7F7C',
22
- paddingRight: '48px'
24
+ justifyContent: 'space-between',
25
+ alignItems: 'center',
26
+ borderTop: '3px solid #8A7F7C',
27
+ paddingRight: '48px',
28
+ paddingTop: '5px',
29
+ paddingBottom: '5px'
30
+ };
31
+ const searchBarContainerStyle = {
32
+ display: 'flex',
33
+ alignItems: 'center',
34
+ marginRight: 'auto',
35
+ paddingLeft: '20px'
36
+ };
37
+ const getSearchBarWrapperStyle = isFocused => ({
38
+ display: 'flex',
39
+ alignItems: 'center',
40
+ width: '337px',
41
+ height: '30px',
42
+ backgroundColor: '#EAF5F5',
43
+ borderRadius: '8px',
44
+ border: isFocused ? '2px solid #15968E' : '1px solid #CCCCCC',
45
+ paddingLeft: '12px',
46
+ paddingRight: '4px',
47
+ opacity: 1
48
+ });
49
+ const searchInputStyle = {
50
+ flex: 1,
51
+ fontSize: '14px',
52
+ '&::placeholder': {
53
+ color: '#757575',
54
+ opacity: 1
55
+ }
56
+ };
57
+ const clearIconButtonStyle = {
58
+ padding: '4px',
59
+ cursor: 'pointer',
60
+ color: '#15968E'
61
+ };
62
+ const noMatchTextStyle = {
63
+ marginLeft: '16px',
64
+ fontSize: '14px',
65
+ color: '#000000',
66
+ fontWeight: 400
23
67
  };
24
68
  const ExtendedView = _ref => {
25
69
  let {
@@ -29,8 +73,20 @@ const ExtendedView = _ref => {
29
73
  onRowsPerPageChange,
30
74
  onPageChange,
31
75
  customTheme,
32
- queryVariables
76
+ queryVariables,
77
+ onSearch,
78
+ initialSearchValue = ''
33
79
  } = _ref;
80
+ const [searchValue, setSearchValue] = (0, _react.useState)(initialSearchValue);
81
+ const [isSearching, setIsSearching] = (0, _react.useState)(!!initialSearchValue);
82
+ const [hasResults, setHasResults] = (0, _react.useState)(true);
83
+ const [isFocused, setIsFocused] = (0, _react.useState)(false);
84
+
85
+ // Update searchValue when initialSearchValue changes
86
+ _react.default.useEffect(() => {
87
+ setSearchValue(initialSearchValue);
88
+ setIsSearching(!!initialSearchValue);
89
+ }, [initialSearchValue]);
34
90
  const {
35
91
  extendedViewConfig
36
92
  } = table;
@@ -39,8 +95,53 @@ const ExtendedView = _ref => {
39
95
  }
40
96
  const {
41
97
  manageViewColumns = false,
42
- pagination = false
98
+ pagination = false,
99
+ hasExport = true
43
100
  } = extendedViewConfig;
101
+
102
+ // Check if this is the Files tab
103
+ const isFilesTab = table.paginationAPIField === 'fileOverview' || table.paginationAPIField === 'getFilenames';
104
+
105
+ // Handler for search functionality
106
+ const handleSearch = () => {
107
+ if (searchValue.trim()) {
108
+ setIsSearching(true);
109
+ if (onSearch) {
110
+ onSearch(searchValue.trim());
111
+ }
112
+ } else {
113
+ // Clear search
114
+ setIsSearching(false);
115
+ setHasResults(true);
116
+ if (onSearch) {
117
+ onSearch('');
118
+ }
119
+ }
120
+ };
121
+
122
+ // Handler for Enter key press
123
+ const handleKeyPress = event => {
124
+ if (event.key === 'Enter') {
125
+ handleSearch();
126
+ }
127
+ };
128
+
129
+ // Handler for clearing search
130
+ const handleClear = () => {
131
+ setSearchValue('');
132
+ setIsSearching(false);
133
+ setHasResults(true);
134
+ if (onSearch) {
135
+ onSearch('');
136
+ }
137
+ };
138
+
139
+ // Update hasResults based on table totalRowCount
140
+ _react.default.useEffect(() => {
141
+ if (isSearching && table.totalRowCount !== undefined) {
142
+ setHasResults(table.totalRowCount > 0);
143
+ }
144
+ }, [table.totalRowCount, isSearching]);
44
145
  const themeConfig = (0, _core.createTheme)({
45
146
  overrides: _objectSpread(_objectSpread({}, (0, _DefaultThemConfig.default)()), customTheme)
46
147
  });
@@ -49,9 +150,35 @@ const ExtendedView = _ref => {
49
150
  }, pagination && /*#__PURE__*/_react.default.createElement("div", {
50
151
  className: "downloadArea",
51
152
  style: downloadAreaStyle
52
- }, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
153
+ }, isFilesTab && /*#__PURE__*/_react.default.createElement("div", {
154
+ style: searchBarContainerStyle
155
+ }, /*#__PURE__*/_react.default.createElement("div", {
156
+ style: getSearchBarWrapperStyle(isFocused)
157
+ }, /*#__PURE__*/_react.default.createElement(_core.InputBase, {
158
+ placeholder: "Search Files",
159
+ value: searchValue,
160
+ onChange: e => setSearchValue(e.target.value),
161
+ onKeyPress: handleKeyPress,
162
+ onFocus: () => setIsFocused(true),
163
+ onBlur: () => setIsFocused(false),
164
+ style: searchInputStyle,
165
+ inputProps: {
166
+ 'aria-label': 'search files'
167
+ }
168
+ }), searchValue && /*#__PURE__*/_react.default.createElement(_core.IconButton, {
169
+ onClick: handleClear,
170
+ style: clearIconButtonStyle,
171
+ size: "small",
172
+ "aria-label": "clear search"
173
+ }, /*#__PURE__*/_react.default.createElement(_Close.default, {
174
+ style: {
175
+ fontSize: '18px'
176
+ }
177
+ }))), isSearching && !hasResults && /*#__PURE__*/_react.default.createElement("span", {
178
+ style: noMatchTextStyle
179
+ }, "No Matching Records Found")), /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
53
180
  customTheme: customTheme.tblTopPgn,
54
- rowsPerPageOptions: [10, 25, 50, 100],
181
+ rowsPerPageOptions: table.rowsPerPageOptions || [10, 25, 50, 100],
55
182
  component: "div",
56
183
  count: table.totalRowCount || 0,
57
184
  rowsPerPage: table.rowsPerPage || 10,
@@ -65,7 +192,7 @@ const ExtendedView = _ref => {
65
192
  manageViewColumns: manageViewColumns,
66
193
  onColumnViewChange: onColumnViewChange,
67
194
  onAllColumnViewChange: onAllColumnViewChange
68
- }), /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
195
+ }), hasExport && /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
69
196
  count: table.totalRowCount || 0,
70
197
  queryVariables: queryVariables,
71
198
  table: table
package/dist/TableView.js CHANGED
@@ -41,7 +41,9 @@ const downloadAreaStyle = {
41
41
  display: 'flex',
42
42
  borderTop: '1px solid #8A7F7C',
43
43
  borderBottom: '1px solid #8A7F7C',
44
- paddingRight: '41px'
44
+ paddingRight: '48px',
45
+ paddingTop: '5px',
46
+ paddingBottom: '5px'
45
47
  };
46
48
  const cartDownloadAreaStyle = {
47
49
  display: 'flex',
@@ -58,6 +60,17 @@ const addScrollContainerStyle = {
58
60
  const addScrollStyle = {
59
61
  height: '14px'
60
62
  };
63
+ const getPaginationStyle = (table, hasExport) => {
64
+ if (table.paginationAPIField === 'filesInList') {
65
+ return cartDownloadAreaStyle;
66
+ }
67
+ if (!hasExport) {
68
+ return _objectSpread(_objectSpread({}, downloadAreaStyle), {}, {
69
+ paddingRight: '0px'
70
+ });
71
+ }
72
+ return downloadAreaStyle;
73
+ };
61
74
  const TableView = _ref => {
62
75
  var _table$selectedRows, _table$selectedRows2;
63
76
  let {
@@ -73,7 +86,9 @@ const TableView = _ref => {
73
86
  onAllColumnViewChange,
74
87
  themeConfig = {},
75
88
  queryVariables,
76
- navigation
89
+ navigation,
90
+ onSearch,
91
+ searchValue
77
92
  } = _ref;
78
93
  (0, _react.useEffect)(() => {
79
94
  const tableContainer = document.getElementById('tableContainer');
@@ -96,7 +111,8 @@ const TableView = _ref => {
96
111
  extendedViewConfig
97
112
  } = table;
98
113
  const {
99
- manageViewColumns = false
114
+ manageViewColumns = false,
115
+ hasExport = true
100
116
  } = extendedViewConfig;
101
117
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ExtendedView.default, {
102
118
  table: table,
@@ -106,7 +122,9 @@ const TableView = _ref => {
106
122
  onPageChange: onPageChange,
107
123
  numSelected: (table === null || table === void 0 ? void 0 : (_table$selectedRows = table.selectedRows) === null || _table$selectedRows === void 0 ? void 0 : _table$selectedRows.length) || 0,
108
124
  customTheme: themeConfig.extendedView,
109
- queryVariables: queryVariables
125
+ queryVariables: queryVariables,
126
+ onSearch: onSearch,
127
+ initialSearchValue: searchValue
110
128
  }), /*#__PURE__*/_react.default.createElement(_CustomToolbar.default, {
111
129
  numSelected: (table === null || table === void 0 ? void 0 : (_table$selectedRows2 = table.selectedRows) === null || _table$selectedRows2 === void 0 ? void 0 : _table$selectedRows2.length) || 0,
112
130
  table: table,
@@ -137,10 +155,10 @@ const TableView = _ref => {
137
155
  table: table
138
156
  }), /*#__PURE__*/_react.default.createElement("div", {
139
157
  className: "downloadArea",
140
- style: table.paginationAPIField === 'filesInList' ? cartDownloadAreaStyle : downloadAreaStyle
158
+ style: getPaginationStyle(table, hasExport)
141
159
  }, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
142
160
  customTheme: themeConfig.tblPgn,
143
- rowsPerPageOptions: [10, 25, 50, 100],
161
+ rowsPerPageOptions: table.rowsPerPageOptions || [10, 25, 50, 100],
144
162
  component: "div",
145
163
  count: table.totalRowCount || 0,
146
164
  rowsPerPage: table.rowsPerPage || 10,
@@ -152,7 +170,7 @@ const TableView = _ref => {
152
170
  manageViewColumns: manageViewColumns,
153
171
  onColumnViewChange: onColumnViewChange,
154
172
  onAllColumnViewChange: onAllColumnViewChange
155
- }), /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
173
+ }), hasExport && /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
156
174
  count: table.totalRowCount || 0,
157
175
  queryVariables: queryVariables,
158
176
  table: table
@@ -38,7 +38,7 @@ const CustomTableBody = _ref => {
38
38
  });
39
39
  return /*#__PURE__*/_react.default.createElement(_core.ThemeProvider, {
40
40
  theme: themeConfig
41
- }, /*#__PURE__*/_react.default.createElement(_core.TableBody, null, rows.map(row => /*#__PURE__*/_react.default.createElement(_core.TableRow, null, displayColunms.map(column => {
41
+ }, /*#__PURE__*/_react.default.createElement(_core.TableBody, null, rows.map((row, rowIndex) => /*#__PURE__*/_react.default.createElement(_core.TableRow, null, displayColunms.map(column => {
42
42
  const {
43
43
  cellType
44
44
  } = column;
@@ -53,6 +53,7 @@ const CustomTableBody = _ref => {
53
53
  return /*#__PURE__*/_react.default.createElement(_DisplayBodyCell.default, {
54
54
  column: column,
55
55
  row: row,
56
+ rowIndex: rowIndex,
56
57
  themeConfig: themeConfig,
57
58
  navigation: navigation
58
59
  });
@@ -50,7 +50,7 @@ const defaultTheme = () => ({
50
50
  MuiCheckbox: {
51
51
  colorSecondary: {
52
52
  '&.Mui-checked': {
53
- color: '#8DCAFF'
53
+ color: '#6D5F5B'
54
54
  }
55
55
  },
56
56
  root: {
@@ -7,9 +7,12 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _core = require("@material-ui/core");
9
9
  var _Types = require("../util/Types");
10
+ var _Dataformat = require("../util/Dataformat");
10
11
  var _CustomLinkView = _interopRequireDefault(require("./components/CustomLinkView"));
11
12
  var _DataFormatView = _interopRequireDefault(require("./components/DataFormatView"));
12
13
  var _CPIView = _interopRequireDefault(require("./components/CPIView"));
14
+ var _CPIMappingView = _interopRequireDefault(require("./components/CPIMappingView"));
15
+ var _StudiesDataAvailabilityView = _interopRequireDefault(require("./components/StudiesDataAvailabilityView"));
13
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
17
  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; }
15
18
  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; }
@@ -28,8 +31,11 @@ const CustomComponent = _ref => {
28
31
  dataField,
29
32
  customCellRender
30
33
  } = column;
34
+ const raw = row[dataField];
35
+ const value = (0, _Dataformat.isBracketStripEnabled)(column) ? (0, _Dataformat.stripSurroundingBrackets)(raw) : raw;
31
36
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, customCellRender(_objectSpread(_objectSpread(_objectSpread({}, row), column), {}, {
32
- label: row[dataField]
37
+ [dataField]: value,
38
+ label: value
33
39
  })));
34
40
  };
35
41
 
@@ -41,6 +47,7 @@ const ViewCell = _ref2 => {
41
47
  let {
42
48
  column,
43
49
  row,
50
+ rowIndex,
44
51
  themeConfig,
45
52
  navigation
46
53
  } = _ref2;
@@ -70,14 +77,28 @@ const ViewCell = _ref2 => {
70
77
  themeConfig: themeConfig,
71
78
  navigation: navigation
72
79
  });
80
+ case _Types.cellTypes.CPI_MAPPING:
81
+ return /*#__PURE__*/_react.default.createElement(_CPIMappingView.default, {
82
+ row: row,
83
+ column: column,
84
+ rowIndex: rowIndex,
85
+ themeConfig: themeConfig,
86
+ navigation: navigation
87
+ });
88
+ case _Types.cellTypes.STUDIES:
89
+ return /*#__PURE__*/_react.default.createElement(_StudiesDataAvailabilityView.default, {
90
+ row: row,
91
+ column: column
92
+ });
73
93
  default:
74
- return /*#__PURE__*/_react.default.createElement(_core.Typography, null, row[column.dataField]);
94
+ return /*#__PURE__*/_react.default.createElement(_core.Typography, null, (0, _Dataformat.isBracketStripEnabled)(column) ? (0, _Dataformat.formatValueForDisplay)(row[column.dataField]) : row[column.dataField]);
75
95
  }
76
96
  };
77
97
  const DisplayCell = _ref3 => {
78
98
  let {
79
99
  row,
80
100
  column,
101
+ rowIndex,
81
102
  themeConfig,
82
103
  navigation
83
104
  } = _ref3;
@@ -86,6 +107,7 @@ const DisplayCell = _ref3 => {
86
107
  }, /*#__PURE__*/_react.default.createElement(ViewCell, {
87
108
  row: row,
88
109
  column: column,
110
+ rowIndex: rowIndex,
89
111
  themeConfig: themeConfig,
90
112
  navigation: navigation
91
113
  }));
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _core = require("@material-ui/core");
9
+ var _Types = require("../../util/Types");
10
+ var _CPI_Icon_Single = _interopRequireDefault(require("./assets/CPI_Icon_Single.svg"));
11
+ var _CPI_Icon_Multi = _interopRequireDefault(require("./assets/CPI_Icon_Multi.svg"));
12
+ var _CPI_Icon_Study = _interopRequireDefault(require("./assets/CPI_Icon_Study.svg"));
13
+ var _CPI_Icon_Dataset = _interopRequireDefault(require("./assets/CPI_Icon_Dataset.svg"));
14
+ var _CPIModal = _interopRequireDefault(require("./CPIModal"));
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ 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); }
17
+ 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; }
18
+ /**
19
+ * CPI Mapping component - displays different icons based on domain_category
20
+ */
21
+
22
+ const CPIMappingView = _ref => {
23
+ let {
24
+ row,
25
+ themeConfig,
26
+ navigation,
27
+ rowIndex
28
+ } = _ref;
29
+ const useStyles = (0, _core.makeStyles)(() => ({
30
+ arrow: {
31
+ '&:before': {
32
+ border: '1px solid black'
33
+ },
34
+ color: 'white'
35
+ },
36
+ tooltip: {
37
+ backgroundColor: 'white',
38
+ border: '1px solid black',
39
+ color: 'black',
40
+ fontFamily: 'Poppins',
41
+ fontWeight: 400,
42
+ fontStyle: 'Regular',
43
+ fontSize: '13px',
44
+ lineHeight: '17.5px',
45
+ letterSpacing: '-0.01em',
46
+ padding: '10px'
47
+ }
48
+ }));
49
+ const classes = useStyles();
50
+ const [modalOpen, setModalOpen] = (0, _react.useState)(false);
51
+ const cpiData = row.cpi_data ? row.cpi_data : [];
52
+
53
+ // Filter ALL CPI data by data_type for tooltip logic
54
+ const internalData = cpiData.filter(e => e.data_type === 'internal');
55
+ const externalData = cpiData.filter(e => e.data_type === 'external');
56
+
57
+ // Group CPI data by domain_category
58
+ const organizationalData = cpiData.filter(e => e.domain_category === 'organizational_identifier');
59
+ const datasetData = cpiData.filter(e => e.domain_category === 'dataset');
60
+ const studyData = cpiData.filter(e => e.domain_category === 'study');
61
+ const handleModalOpen = () => {
62
+ setModalOpen(true);
63
+ };
64
+ const handleModalClose = () => {
65
+ setModalOpen(false);
66
+ };
67
+ const button = {
68
+ color: '#07679C',
69
+ textDecoration: 'underline',
70
+ fontWeight: 700,
71
+ cursor: 'pointer',
72
+ padding: 0,
73
+ marginLeft: '3px'
74
+ };
75
+ const italicText = {
76
+ fontFamily: 'Poppins',
77
+ fontWeight: 400,
78
+ fontStyle: 'italic',
79
+ fontSize: '13px',
80
+ lineHeight: '19px',
81
+ letterSpacing: '-0.01em'
82
+ };
83
+ const iconContainer = {
84
+ display: 'flex',
85
+ alignItems: 'center',
86
+ justifyContent: 'flex-start',
87
+ gap: '24px',
88
+ width: '150px'
89
+ };
90
+ const icon = {
91
+ position: 'relative',
92
+ cursor: 'pointer',
93
+ display: 'inline-block'
94
+ };
95
+ const badgeContainer = {
96
+ position: 'relative',
97
+ display: 'inline-block'
98
+ };
99
+
100
+ // Determine row background color based on index (even rows are gray)
101
+ const isEvenRow = rowIndex !== undefined && rowIndex % 2 === 1;
102
+ const rowBackgroundColor = isEvenRow ? '#f4f5f5' : 'white';
103
+ const getBadgeStyle = (count, iconType) => {
104
+ let rightOffset = '-8px';
105
+ let bottomOffset = '0.5px';
106
+ let boxShadow = 'none';
107
+ if (iconType === 'organizational' && count === 1) {
108
+ rightOffset = '-6px';
109
+ bottomOffset = '0.5px';
110
+ } else if (iconType === 'organizational') {
111
+ // Multi organizational icon - no box shadow needed
112
+ rightOffset = '-8px';
113
+ boxShadow = 'none';
114
+ } else {
115
+ // Dataset and Study icons need gap
116
+ boxShadow = "0 0 0 2px ".concat(rowBackgroundColor);
117
+ }
118
+ return {
119
+ position: 'absolute',
120
+ right: rightOffset,
121
+ bottom: bottomOffset,
122
+ backgroundColor: 'white',
123
+ border: '1.5px solid #2A6E93',
124
+ borderRadius: '4px',
125
+ minWidth: '12px',
126
+ height: '12px',
127
+ display: 'flex',
128
+ alignItems: 'center',
129
+ justifyContent: 'center',
130
+ padding: '2px 3px',
131
+ fontSize: '8px',
132
+ fontWeight: 700,
133
+ fontStyle: 'normal',
134
+ lineHeight: '16px',
135
+ letterSpacing: '-0.02em',
136
+ color: '#2A6E93',
137
+ fontFamily: 'Open Sans',
138
+ boxShadow
139
+ };
140
+ };
141
+ const renderIcon = (iconSrc, count, iconType) => {
142
+ if (count === 0) return null;
143
+ let tooltipContent;
144
+
145
+ // Same tooltip logic for all icon types
146
+ if (externalData.length === 1 && internalData.length === 0) {
147
+ tooltipContent = /*#__PURE__*/_react.default.createElement("div", null, "dbGaP identifier mapped in the CCDI Participant Index (CPI) is available", /*#__PURE__*/_react.default.createElement("span", {
148
+ role: "button",
149
+ onClick: handleModalOpen,
150
+ tabIndex: 0,
151
+ style: button
152
+ }, "here."));
153
+ } else if (externalData.length > 1 && internalData.length === 0) {
154
+ tooltipContent = /*#__PURE__*/_react.default.createElement("div", null, "Multiple alternative identifiers mapped in the CCDI Participant Index (CPI) are available", /*#__PURE__*/_react.default.createElement("span", {
155
+ role: "button",
156
+ onClick: handleModalOpen,
157
+ tabIndex: 0,
158
+ style: button
159
+ }, "here."));
160
+ } else {
161
+ // Has internal identifiers
162
+ tooltipContent = /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
163
+ style: {
164
+ marginBottom: '6px'
165
+ }
166
+ }, "This participant has more than one identifier in CCDI Hub studies:"), internalData.map(e => /*#__PURE__*/_react.default.createElement("div", {
167
+ key: e.associated_id,
168
+ style: italicText
169
+ }, "".concat(e.associated_id, ", ").concat(e.repository_of_synonym_id))), /*#__PURE__*/_react.default.createElement("div", {
170
+ style: {
171
+ marginTop: '6px'
172
+ }
173
+ }, "Additional alternative identifiers mapped in the CCDI Participant Index (CPI) for this participant are available", /*#__PURE__*/_react.default.createElement("span", {
174
+ role: "button",
175
+ onClick: handleModalOpen,
176
+ tabIndex: 0,
177
+ style: button
178
+ }, "here.")));
179
+ }
180
+ return /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
181
+ key: "".concat(iconType, "-tooltip"),
182
+ interactive: true,
183
+ placement: "top",
184
+ classes: {
185
+ arrow: classes.arrow,
186
+ tooltip: classes.tooltip
187
+ },
188
+ arrow: true,
189
+ title: tooltipContent
190
+ }, /*#__PURE__*/_react.default.createElement("span", {
191
+ style: icon
192
+ }, /*#__PURE__*/_react.default.createElement("span", {
193
+ style: badgeContainer
194
+ }, /*#__PURE__*/_react.default.createElement("img", {
195
+ src: iconSrc,
196
+ height: 21,
197
+ width: 23,
198
+ alt: "cpi-".concat(iconType, "-icon")
199
+ }), /*#__PURE__*/_react.default.createElement("span", {
200
+ style: getBadgeStyle(count, iconType)
201
+ }, count))));
202
+ };
203
+ const getOrganizationalIcon = count => count === 1 ? _CPI_Icon_Single.default : _CPI_Icon_Multi.default;
204
+ if (!cpiData.length) {
205
+ return /*#__PURE__*/_react.default.createElement(_core.Typography, null);
206
+ }
207
+ return /*#__PURE__*/_react.default.createElement(_core.Typography, {
208
+ className: _Types.cellTypes.CPI_MAPPING
209
+ }, /*#__PURE__*/_react.default.createElement(_CPIModal.default, {
210
+ key: "".concat(row.id, "-").concat(row.participant_id),
211
+ row: row,
212
+ open: modalOpen,
213
+ onClose: handleModalClose,
214
+ themeConfig: themeConfig,
215
+ navigation: navigation
216
+ }), /*#__PURE__*/_react.default.createElement("div", {
217
+ style: iconContainer
218
+ }, organizationalData.length > 0 && renderIcon(getOrganizationalIcon(organizationalData.length), organizationalData.length, 'organizational'), datasetData.length > 0 && renderIcon(_CPI_Icon_Dataset.default, datasetData.length, 'dataset'), studyData.length > 0 && renderIcon(_CPI_Icon_Study.default, studyData.length, 'study')));
219
+ };
220
+ var _default = CPIMappingView;
221
+ exports.default = _default;