@bento-core/table 1.0.1-ccdihub.12 → 1.0.1-ccdihub.121

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 (95) hide show
  1. package/dist/DefaultThemConfig.js +6 -2
  2. package/dist/ExtendedView.js +155 -17
  3. package/dist/TableView.js +96 -8
  4. package/dist/body/CustomTblBody.js +7 -3
  5. package/dist/body/DisplayBodyCell.js +29 -3
  6. package/dist/body/components/CPIMappingView.js +221 -0
  7. package/dist/body/components/CPIModal.js +703 -0
  8. package/dist/body/components/CPIView.js +171 -0
  9. package/dist/body/components/CustomLinkView.js +1 -1
  10. package/dist/body/components/ModalStyle.js +121 -0
  11. package/dist/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  12. package/dist/body/components/assets/CPI_Icon_Multi.svg +6 -0
  13. package/dist/body/components/assets/CPI_Icon_Single.svg +4 -0
  14. package/dist/body/components/assets/CPI_Icon_Study.svg +11 -0
  15. package/dist/body/components/assets/CPI_icon.svg +22 -0
  16. package/dist/body/components/assets/Cart_Icon.svg +3 -0
  17. package/dist/body/components/assets/Question_Icon.svg +4 -0
  18. package/dist/body/components/assets/download.svg +3 -0
  19. package/dist/header/ActionHeaderCell.js +2 -1
  20. package/dist/header/CustomCell.js +6 -3
  21. package/dist/header/CustomTblHeader.js +4 -1
  22. package/dist/header/components/CheckBoxView.js +3 -2
  23. package/dist/index.js +13 -0
  24. package/dist/pagination/CustomPagination.js +12 -8
  25. package/dist/toolbar/DownloadButtonView.js +207 -7
  26. package/dist/toolbar/ManageColumnView.js +212 -38
  27. package/dist/toolbar/SearchBar.js +92 -0
  28. package/dist/toolbar/assets/Hidden_Column.svg +4 -0
  29. package/dist/toolbar/assets/Search_Icon.svg +3 -0
  30. package/dist/toolbar/assets/View_Columns.svg +6 -0
  31. package/dist/util/Dataformat.js +41 -1
  32. package/dist/util/Types.js +31 -2
  33. package/dist/util/downloadTable.js +196 -0
  34. package/dist/wrapper/WrapperService.js +36 -0
  35. package/dist/wrapper/components/AddFiles.js +63 -0
  36. package/dist/wrapper/components/AddToCart/AddToCartView.js +126 -0
  37. package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +27 -0
  38. package/dist/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +35 -0
  39. package/dist/wrapper/components/AddToCartDialog/AddToCartDialogController.js +36 -0
  40. package/dist/wrapper/components/AddToCartDialog/AddToCartDialogView.js +43 -0
  41. package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +178 -0
  42. package/dist/wrapper/components/ReduxAddFile.js +27 -0
  43. package/dist/wrapper/components/Snackbar/Snackbar.js +45 -0
  44. package/dist/wrapper/components/Snackbar/SnackbarRedux.js +16 -0
  45. package/dist/wrapper/components/Snackbar/SuccessOutlined.js +17 -0
  46. package/dist/wrapper/components/TextFieldView.js +37 -0
  47. package/dist/wrapper/components/TooltipView.js +40 -0
  48. package/package.json +11 -1
  49. package/src/DefaultThemConfig.js +6 -2
  50. package/src/ExtendedView.js +176 -22
  51. package/src/TableView.js +143 -52
  52. package/src/body/CustomTblBody.js +5 -1
  53. package/src/body/DisplayBodyCell.js +30 -0
  54. package/src/body/components/CPIMappingView.js +260 -0
  55. package/src/body/components/CPIModal.js +777 -0
  56. package/src/body/components/CPIView.js +188 -0
  57. package/src/body/components/CustomLinkView.js +1 -1
  58. package/src/body/components/ModalStyle.js +115 -0
  59. package/src/body/components/assets/CPI_Icon_Dataset.svg +6 -0
  60. package/src/body/components/assets/CPI_Icon_Multi.svg +6 -0
  61. package/src/body/components/assets/CPI_Icon_Single.svg +4 -0
  62. package/src/body/components/assets/CPI_Icon_Study.svg +11 -0
  63. package/src/body/components/assets/CPI_icon.svg +22 -0
  64. package/src/body/components/assets/Cart_Icon.svg +3 -0
  65. package/src/body/components/assets/Question_Icon.svg +4 -0
  66. package/src/body/components/assets/download.svg +3 -0
  67. package/src/header/ActionHeaderCell.js +1 -1
  68. package/src/header/CustomCell.js +3 -0
  69. package/src/header/CustomTblHeader.js +1 -0
  70. package/src/header/components/CheckBoxView.js +2 -1
  71. package/src/index.js +2 -0
  72. package/src/pagination/CustomPagination.js +16 -20
  73. package/src/toolbar/DownloadButtonView.js +199 -10
  74. package/src/toolbar/ManageColumnView.js +207 -46
  75. package/src/toolbar/SearchBar.js +90 -0
  76. package/src/toolbar/assets/Hidden_Column.svg +4 -0
  77. package/src/toolbar/assets/Search_Icon.svg +3 -0
  78. package/src/toolbar/assets/View_Columns.svg +6 -0
  79. package/src/util/Dataformat.js +25 -0
  80. package/src/util/Types.js +21 -0
  81. package/src/util/downloadTable.js +138 -0
  82. package/src/wrapper/WrapperService.js +25 -0
  83. package/src/wrapper/components/AddFiles.js +62 -0
  84. package/src/wrapper/components/AddToCart/AddToCartView.js +132 -0
  85. package/src/wrapper/components/AddToCart/ReduxAddToCart.js +20 -0
  86. package/src/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +37 -0
  87. package/src/wrapper/components/AddToCartDialog/AddToCartDialogController.js +32 -0
  88. package/src/wrapper/components/AddToCartDialog/AddToCartDialogView.js +57 -0
  89. package/src/wrapper/components/CPIFilesView/CPIFilesView.js +190 -0
  90. package/src/wrapper/components/ReduxAddFile.js +20 -0
  91. package/src/wrapper/components/Snackbar/Snackbar.js +44 -0
  92. package/src/wrapper/components/Snackbar/SnackbarRedux.js +11 -0
  93. package/src/wrapper/components/Snackbar/SuccessOutlined.js +10 -0
  94. package/src/wrapper/components/TextFieldView.js +32 -0
  95. package/src/wrapper/components/TooltipView.js +35 -0
@@ -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;