@bento-core/table 1.0.1-ccdihub.99 → 1.0.1-ccdiintegrated.2
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 +134 -7
- package/dist/TableView.js +23 -7
- package/dist/body/CustomTblBody.js +2 -1
- package/dist/body/DisplayBodyCell.js +18 -0
- package/dist/body/components/CPIMappingView.js +221 -0
- package/dist/body/components/CPIModal.js +434 -93
- package/dist/body/components/CPIView.js +64 -10
- package/dist/body/components/StudiesDataAvailabilityView.js +125 -0
- package/dist/body/components/assets/CPI_Icon_Dataset.svg +6 -0
- package/dist/body/components/assets/CPI_Icon_Multi.svg +6 -0
- package/dist/body/components/assets/CPI_Icon_Single.svg +4 -0
- package/dist/body/components/assets/CPI_Icon_Study.svg +11 -0
- package/dist/body/components/assets/Participant_Files.svg +17 -0
- package/dist/body/components/assets/Publications.svg +15 -0
- package/dist/body/components/assets/Sample_Files.svg +16 -0
- package/dist/body/components/assets/Study_Files.svg +21 -0
- package/dist/body/components/assets/download.svg +3 -0
- package/dist/header/CustomCell.js +4 -3
- package/dist/header/CustomTblHeader.js +16 -3
- package/dist/index.js +7 -0
- package/dist/toolbar/DownloadButtonView.js +30 -4
- package/dist/toolbar/SearchBar.js +92 -0
- package/dist/toolbar/assets/Search_Icon.svg +3 -0
- package/dist/util/Types.js +16 -4
- package/dist/util/downloadTable.js +36 -1
- package/dist/wrapper/components/AddToCart/AddToCartView.js +126 -0
- package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +27 -0
- package/dist/wrapper/components/Snackbar/Snackbar.js +5 -0
- package/package.json +23 -22
- package/src/ExtendedView.js +146 -7
- package/src/TableView.js +27 -8
- package/src/body/CustomTblBody.js +2 -1
- package/src/body/DisplayBodyCell.js +22 -0
- package/src/body/components/CPIMappingView.js +260 -0
- package/src/body/components/CPIModal.js +464 -101
- package/src/body/components/CPIView.js +75 -22
- package/src/body/components/StudiesDataAvailabilityView.js +121 -0
- package/src/body/components/assets/CPI_Icon_Dataset.svg +6 -0
- package/src/body/components/assets/CPI_Icon_Multi.svg +6 -0
- package/src/body/components/assets/CPI_Icon_Single.svg +4 -0
- package/src/body/components/assets/CPI_Icon_Study.svg +11 -0
- package/src/body/components/assets/Participant_Files.svg +17 -0
- package/src/body/components/assets/Publications.svg +15 -0
- package/src/body/components/assets/Sample_Files.svg +16 -0
- package/src/body/components/assets/Study_Files.svg +21 -0
- package/src/body/components/assets/download.svg +3 -0
- package/src/header/CustomCell.js +4 -3
- package/src/header/CustomTblHeader.js +13 -1
- package/src/index.js +1 -0
- package/src/toolbar/DownloadButtonView.js +20 -4
- package/src/toolbar/SearchBar.js +90 -0
- package/src/toolbar/assets/Search_Icon.svg +3 -0
- package/src/util/Types.js +10 -1
- package/src/util/downloadTable.js +37 -1
- package/src/wrapper/components/AddToCart/AddToCartView.js +132 -0
- package/src/wrapper/components/AddToCart/ReduxAddToCart.js +20 -0
- package/src/wrapper/components/Snackbar/Snackbar.js +1 -0
package/dist/ExtendedView.js
CHANGED
|
@@ -4,13 +4,16 @@ 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
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',
|
|
24
|
+
justifyContent: 'space-between',
|
|
25
|
+
alignItems: 'center',
|
|
21
26
|
borderTop: '1px solid #8A7F7C',
|
|
22
|
-
paddingRight: '48px'
|
|
27
|
+
paddingRight: '48px',
|
|
28
|
+
paddingTop: '5px',
|
|
29
|
+
paddingBottom: '5px'
|
|
30
|
+
};
|
|
31
|
+
const searchBarContainerStyle = {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
marginRight: 'auto',
|
|
35
|
+
paddingLeft: '18px'
|
|
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(
|
|
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,7 @@ const downloadAreaStyle = {
|
|
|
41
41
|
display: 'flex',
|
|
42
42
|
borderTop: '1px solid #8A7F7C',
|
|
43
43
|
borderBottom: '1px solid #8A7F7C',
|
|
44
|
-
paddingRight: '
|
|
44
|
+
paddingRight: '48px'
|
|
45
45
|
};
|
|
46
46
|
const cartDownloadAreaStyle = {
|
|
47
47
|
display: 'flex',
|
|
@@ -58,6 +58,17 @@ const addScrollContainerStyle = {
|
|
|
58
58
|
const addScrollStyle = {
|
|
59
59
|
height: '14px'
|
|
60
60
|
};
|
|
61
|
+
const getPaginationStyle = (table, hasExport) => {
|
|
62
|
+
if (table.paginationAPIField === 'filesInList') {
|
|
63
|
+
return cartDownloadAreaStyle;
|
|
64
|
+
}
|
|
65
|
+
if (!hasExport) {
|
|
66
|
+
return _objectSpread(_objectSpread({}, downloadAreaStyle), {}, {
|
|
67
|
+
paddingRight: '0px'
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return downloadAreaStyle;
|
|
71
|
+
};
|
|
61
72
|
const TableView = _ref => {
|
|
62
73
|
var _table$selectedRows, _table$selectedRows2;
|
|
63
74
|
let {
|
|
@@ -73,7 +84,9 @@ const TableView = _ref => {
|
|
|
73
84
|
onAllColumnViewChange,
|
|
74
85
|
themeConfig = {},
|
|
75
86
|
queryVariables,
|
|
76
|
-
navigation
|
|
87
|
+
navigation,
|
|
88
|
+
onSearch,
|
|
89
|
+
searchValue
|
|
77
90
|
} = _ref;
|
|
78
91
|
(0, _react.useEffect)(() => {
|
|
79
92
|
const tableContainer = document.getElementById('tableContainer');
|
|
@@ -96,7 +109,8 @@ const TableView = _ref => {
|
|
|
96
109
|
extendedViewConfig
|
|
97
110
|
} = table;
|
|
98
111
|
const {
|
|
99
|
-
manageViewColumns = false
|
|
112
|
+
manageViewColumns = false,
|
|
113
|
+
hasExport = true
|
|
100
114
|
} = extendedViewConfig;
|
|
101
115
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ExtendedView.default, {
|
|
102
116
|
table: table,
|
|
@@ -106,7 +120,9 @@ const TableView = _ref => {
|
|
|
106
120
|
onPageChange: onPageChange,
|
|
107
121
|
numSelected: (table === null || table === void 0 ? void 0 : (_table$selectedRows = table.selectedRows) === null || _table$selectedRows === void 0 ? void 0 : _table$selectedRows.length) || 0,
|
|
108
122
|
customTheme: themeConfig.extendedView,
|
|
109
|
-
queryVariables: queryVariables
|
|
123
|
+
queryVariables: queryVariables,
|
|
124
|
+
onSearch: onSearch,
|
|
125
|
+
initialSearchValue: searchValue
|
|
110
126
|
}), /*#__PURE__*/_react.default.createElement(_CustomToolbar.default, {
|
|
111
127
|
numSelected: (table === null || table === void 0 ? void 0 : (_table$selectedRows2 = table.selectedRows) === null || _table$selectedRows2 === void 0 ? void 0 : _table$selectedRows2.length) || 0,
|
|
112
128
|
table: table,
|
|
@@ -137,10 +153,10 @@ const TableView = _ref => {
|
|
|
137
153
|
table: table
|
|
138
154
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
139
155
|
className: "downloadArea",
|
|
140
|
-
style: table
|
|
156
|
+
style: getPaginationStyle(table, hasExport)
|
|
141
157
|
}, /*#__PURE__*/_react.default.createElement(_CustomPagination.default, {
|
|
142
158
|
customTheme: themeConfig.tblPgn,
|
|
143
|
-
rowsPerPageOptions: [10, 25, 50, 100],
|
|
159
|
+
rowsPerPageOptions: table.rowsPerPageOptions || [10, 25, 50, 100],
|
|
144
160
|
component: "div",
|
|
145
161
|
count: table.totalRowCount || 0,
|
|
146
162
|
rowsPerPage: table.rowsPerPage || 10,
|
|
@@ -152,7 +168,7 @@ const TableView = _ref => {
|
|
|
152
168
|
manageViewColumns: manageViewColumns,
|
|
153
169
|
onColumnViewChange: onColumnViewChange,
|
|
154
170
|
onAllColumnViewChange: onAllColumnViewChange
|
|
155
|
-
}), /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
|
|
171
|
+
}), hasExport && /*#__PURE__*/_react.default.createElement(_DownloadButtonView.default, {
|
|
156
172
|
count: table.totalRowCount || 0,
|
|
157
173
|
queryVariables: queryVariables,
|
|
158
174
|
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
|
});
|
|
@@ -10,6 +10,8 @@ var _Types = require("../util/Types");
|
|
|
10
10
|
var _CustomLinkView = _interopRequireDefault(require("./components/CustomLinkView"));
|
|
11
11
|
var _DataFormatView = _interopRequireDefault(require("./components/DataFormatView"));
|
|
12
12
|
var _CPIView = _interopRequireDefault(require("./components/CPIView"));
|
|
13
|
+
var _CPIMappingView = _interopRequireDefault(require("./components/CPIMappingView"));
|
|
14
|
+
var _StudiesDataAvailabilityView = _interopRequireDefault(require("./components/StudiesDataAvailabilityView"));
|
|
13
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
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; }
|
|
15
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; }
|
|
@@ -41,6 +43,7 @@ const ViewCell = _ref2 => {
|
|
|
41
43
|
let {
|
|
42
44
|
column,
|
|
43
45
|
row,
|
|
46
|
+
rowIndex,
|
|
44
47
|
themeConfig,
|
|
45
48
|
navigation
|
|
46
49
|
} = _ref2;
|
|
@@ -70,6 +73,19 @@ const ViewCell = _ref2 => {
|
|
|
70
73
|
themeConfig: themeConfig,
|
|
71
74
|
navigation: navigation
|
|
72
75
|
});
|
|
76
|
+
case _Types.cellTypes.CPI_MAPPING:
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement(_CPIMappingView.default, {
|
|
78
|
+
row: row,
|
|
79
|
+
column: column,
|
|
80
|
+
rowIndex: rowIndex,
|
|
81
|
+
themeConfig: themeConfig,
|
|
82
|
+
navigation: navigation
|
|
83
|
+
});
|
|
84
|
+
case _Types.cellTypes.STUDIES:
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(_StudiesDataAvailabilityView.default, {
|
|
86
|
+
row: row,
|
|
87
|
+
column: column
|
|
88
|
+
});
|
|
73
89
|
default:
|
|
74
90
|
return /*#__PURE__*/_react.default.createElement(_core.Typography, null, row[column.dataField]);
|
|
75
91
|
}
|
|
@@ -78,6 +94,7 @@ const DisplayCell = _ref3 => {
|
|
|
78
94
|
let {
|
|
79
95
|
row,
|
|
80
96
|
column,
|
|
97
|
+
rowIndex,
|
|
81
98
|
themeConfig,
|
|
82
99
|
navigation
|
|
83
100
|
} = _ref3;
|
|
@@ -86,6 +103,7 @@ const DisplayCell = _ref3 => {
|
|
|
86
103
|
}, /*#__PURE__*/_react.default.createElement(ViewCell, {
|
|
87
104
|
row: row,
|
|
88
105
|
column: column,
|
|
106
|
+
rowIndex: rowIndex,
|
|
89
107
|
themeConfig: themeConfig,
|
|
90
108
|
navigation: navigation
|
|
91
109
|
}));
|
|
@@ -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 #07679C',
|
|
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: '#07679C',
|
|
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;
|