@bento-core/paginated-table 1.0.1-icdc.2 → 1.0.1-icdc.4

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.
@@ -0,0 +1,86 @@
1
+
2
+ ### 1 Use bento-core/paginated-table package version publish by ICDC
3
+ Alternative configuratoin for BLUE button
4
+ ```
5
+ // 1.0.1-icdc.3
6
+ npm i @bento-core/paginated-table@1.0.1-icdc.3
7
+
8
+ or in package.json
9
+ {
10
+ @bento-core/paginated-table: '1.0.1-icdc.3'
11
+ }
12
+ ```
13
+ **NOTE: Create a new dashboard page using bento-core components before removing old dashboard page**
14
+ <br>
15
+ <span style="color:red">
16
+ Assuming New Dashboard page have Filter component and table component from bento-core
17
+ </span>.
18
+
19
+
20
+
21
+ ### 2 Configure Add_All_Button Or BLUE Button in Dashboard
22
+
23
+ ```
24
+ import React, { useCallback } from 'react';
25
+ import { ButtonView, btnTypes } from '@bento-core/paginated-table';
26
+
27
+ const AddAllBlueButton = useCallback(() => (
28
+ <ButtonView
29
+ btnType={btnTypes.ADD_ALL_FILES}
30
+ title="Add All Files Btn"
31
+ clsName="add_all_button"
32
+ maxFileLimit={10000}
33
+ addFileQuery={GET_ALL_FILEIDS_CASESTAB_FOR_SELECT_ALL}
34
+ responseKeys={['caseOverview', 'files']}
35
+ activeFilters={activeFilters}
36
+ classes={classes}
37
+ section="toolTipText"
38
+ tooltipCofig={{
39
+ arrow: true,
40
+ clsName: 'addAllTooltip',
41
+ toolTipText: 'Add filtered files associated with all cases',
42
+ icon: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/icdc/images/svgs/Tooltip.SpeechBubble.svg',
43
+ }}
44
+ />
45
+ ), []);
46
+ ```
47
+
48
+ **Add All Button Component or Configuration Properties**
49
+ | Component Props | Required | description | Configuration |
50
+ | :--- | :----:| :----: | ----: |
51
+ | btnType | TRUE | Determines the role of the button, add all files (blue) or add selected files (orange) | btnTypes.ADD_ALL_FILES, btnTypes.ADD_SELECTED_FILES or btnTypes.DOWNLOAD_MANIFEST |
52
+ | title | TRUE | text for the button | 'Add all files' |
53
+ | clsName | TRUE | configure theme with themeprovider | |
54
+ | maxFileLimit | FALSE | limits no of files that can be added to myCart | 0 - 10000 (by default 1000) |
55
+ | addFileQuery | TRUE | query to retrive files or file ids | graphQL query |
56
+ | responseKeys | TRUE | Keys to access file_ids reponse provided by addFileQuery, provided as list to access the nested respose object or list (max depth upto 2) | ['caseOverview', 'files'] |
57
+ | section | TRUE | This key is used for accessing the tootip text provided in tooltipCofig | section="toolTipText" |
58
+ | classes | TRUE | provide class for toltips to override the style | tooltip: classes.customTooltip, arrow: classes.customArrow
59
+ | tooltipCofig | FALSE | displays tooltip if provided, configuration for arrow, clsName, icon, tooltipText | graphQL query |
60
+ | activeFilters | TRUE | filtes the case or sample based on the active filters | graphQL query |
61
+
62
+
63
+ ### 3 Configure Add_All_Button Or BLUE Button in Dashboard
64
+
65
+ ```
66
+ const customTheme = {
67
+ MuiContainer: {
68
+ root: {
69
+ '& img': {
70
+ width: '17px',
71
+ '&.addAllTooltip': {
72
+ verticalAlign: 'top',
73
+ marginTop: '8px',
74
+ },
75
+ },
76
+ },
77
+ },
78
+ };
79
+
80
+ const btnTheme = createTheme({ overrides: { ...customTheme } });
81
+ <ThemeProvider theme={btnTheme}>
82
+ <Container>
83
+ <AddAllBlueButton /> // from step 2
84
+ </Container>
85
+ </ThemeProvider>
86
+ ```
@@ -0,0 +1,79 @@
1
+
2
+ ### 1 Use bento-core/paginated-table package version publish by ICDC
3
+ Alternative configuration for ORANGE button
4
+ ```
5
+ // 1.0.1-icdc.3
6
+ npm i @bento-core/paginated-table@1.0.1-icdc.3
7
+
8
+ or in package.json
9
+ {
10
+ @bento-core/paginated-table: '1.0.1-icdc.3'
11
+ }
12
+ ```
13
+
14
+ <span style="color:red">
15
+ Assuming table component is imported from bento-core/paginated-table
16
+ </span>
17
+
18
+ ### 2 Configure Add_All_Button Or BLUE Button in Dashboard
19
+
20
+ ```
21
+ import React, { useCallback } from 'react';
22
+ import { ButtonView, btnTypes } from '@bento-core/paginated-table';
23
+
24
+ const AddSelectedFilesOrangeButton = useCallback(() => (
25
+ <ButtonView
26
+ btnType={btnTypes.ADD_SELECTED_FILES}
27
+ title="ADD SELECTED FILES Btn"
28
+ clsName="add_selected_button"
29
+ dataKey="case_ids"
30
+ addFileQuery={GET_ALL_FILEIDS_CASESTAB_FOR_SELECT_ALL}
31
+ responseKeys={['caseOverview', 'files']}
32
+ classes={classes}
33
+ tooltipCofig={{
34
+ arrow: true,
35
+ clsName: 'addSelectedFileTooltip',
36
+ tooltipText: 'Add files associated selected cases',
37
+ icon: 'https://raw.githubusercontent.com/CBIIT/datacommons-assets/main/icdc/images/svgs/Tooltip.SpeechBubble.svg',
38
+ }}
39
+ />
40
+ ), []);
41
+ ```
42
+
43
+ **Add All Button Component or Configuration Properties**
44
+ | Component Props | Required | description | Configuration |
45
+ | :--- | :----:| :----: | ----: |
46
+ | btnType | TRUE | Determines the role of the button, add all files (blue) or add selected files (orange) | btnTypes.ADD_ALL_FILES, btnTypes.ADD_SELECTED_FILES or btnTypes.DOWNLOAD_MANIFEST |
47
+ | title | TRUE | text for the button | 'Add Selected files' |
48
+ | clsName | TRUE | configure theme with themeprovider | |
49
+ | addFileQuery | TRUE | query to retrive files or file ids | graphQL query |
50
+ | responseKeys | TRUE | Keys to access file_ids reponse provided by addFileQuery, provided as list to access the nested respose object or list (max depth upto 2) | ['caseOverview', 'files'] |
51
+ | classes | TRUE | provide class for toltips to override the style | tooltip: classes.customTooltip, arrow: classes.customArrow
52
+ | tooltipCofig | FALSE | displays tooltip if provided, configuration for arrow, clsName, icon, tooltipText | graphQL query |
53
+ | dataKey | TRUE | Attribute used for getting selected rows in a table | case_id, file_name or any other column with distinct values |
54
+
55
+
56
+ ### 3 Configure Add_All_Button Or BLUE Button in Dashboard
57
+
58
+ ```
59
+ const customTheme = {
60
+ MuiContainer: {
61
+ root: {
62
+ '& img': {
63
+ width: '17px',
64
+ '&.addAllTooltip': {
65
+ verticalAlign: 'top',
66
+ marginTop: '8px',
67
+ },
68
+ },
69
+ },
70
+ },
71
+ };
72
+
73
+ const btnTheme = createTheme({ overrides: { ...customTheme } });
74
+ <ThemeProvider theme={btnTheme}>
75
+ <Container>
76
+ <AddSelectedFilesOrangeButton /> // from step 2
77
+ </Container>
78
+ </ThemeProvider>
79
+ ```
@@ -13,67 +13,6 @@
13
13
 
14
14
  ### Generate and integrate redux dispatch actions
15
15
  ```
16
- const config = {
17
- title: 'program',
18
- dataField: 'studiesByProgram',
19
- extendedViewConfig: { // display download button and manage view column
20
- download: {
21
- downloadFileName: 'ICDC_Studies_download',
22
- downloadCsv: 'Download Table Contents As CSV',
23
- },
24
- manageViewColumns: {
25
- title: 'View Columns',
26
- },
27
- }
28
- columns: [
29
- {
30
- cellType: cellTypes.CHECKBOX,
31
- display: true,
32
- role: cellTypes.CHECKBOX,
33
- },
34
- {
35
- dataField: 'program_id',
36
- header: 'Program',
37
- cellType: cellTypes.LINK,
38
- linkAttr: {
39
- rootPath: '/program',
40
- pathParams: ['program_id'],
41
- },
42
- role: cellTypes.DISPLAY,
43
- display: true,
44
- },
45
- {
46
- dataField: 'clinical_study_name',
47
- header: 'Study Name',
48
- display: true,
49
- tooltipText: 'sort',
50
- role: cellTypes.DISPLAY, // to display column in managecolumn view
51
- },
52
- {
53
- dataField: 'numberOfStudyFiles',
54
- header: 'Study File(s)',
55
- display: true,
56
- columnDefaultValues: {
57
- '0': 'Not Applicable', // replaces 0 with other text value in a column
58
- },
59
- role: cellTypes.DISPLAY,
60
- }
61
- ],
62
- columnGroups: {
63
- {
64
- clsName: 'col_group_1',
65
- title: 'column group title',
66
- columnIndexes: [startColIndex, endColIndex],
67
- },
68
- {
69
- clsName: 'col_group_2',
70
- title: 'column group title',
71
- customViewRender: () => <h2>'custom Text'</h2>, // customize element (takes priority over title)
72
- columnIndexes: [startColIndex, endColIndex],
73
- },
74
- }
75
- }
76
-
77
16
  const initTblState = (initailState) => ({
78
17
  ...initailState,
79
18
  title: config.name,
@@ -86,7 +25,6 @@ const initTblState = (initailState) => ({
86
25
  paginationAPIField: config.paginationAPIField,
87
26
  sortBy: config.defaultSortField,
88
27
  sortOrder: config.defaultSortDirection,
89
- columnGroups: config.columnGroups
90
28
  rowsPerPage: 10,
91
29
  page: 0,
92
30
  });
@@ -107,9 +45,7 @@ const initTblState = (initailState) => ({
107
45
  | sortOrder | FALSE | default sort column 'ASC' | ```defaultSortDirection: 'asc',```|
108
46
  | rowsPerPage | FALSE | default 10 | |
109
47
  | page | FALSE | 0 | |
110
- | extendedViewConfig | FALSE | extended view of table header component | refer bento-frontend / bento-icdc-frontend tabContainers, dashboardTabData.js |
111
- | ColumnGroups | FALSE | ColumnGrouping Component | refer bento-icdc-frontend tabContainers, StudiesData.js |
112
-
48
+ | extendedViewConfig | FALSE | extended view of table header component | refer bento-frontend tabContainers, dashboardTabData.js |
113
49
 
114
50
 
115
51
  ### 2 Importing Component and Configuration
@@ -189,14 +125,13 @@ const initTblState = (initailState) => ({
189
125
  sortBy: config.defaultSortField,
190
126
  sortOrder: config.defaultSortDirection,
191
127
  extendedViewConfig: config.extendedViewConfig,
192
- columnGroups: config.columnGroups,
193
128
  rowsPerPage: 10,
194
129
  page: 0,
195
130
  });
196
131
 
197
132
  <TableContextProvider>
198
133
  <Wrapper
199
- wrapConfig={configWrapper(tableLayout)} // tableLayout - refer to step #4
134
+ wrapConfig={configWrapper(config, wrapperConfig)}
200
135
  customTheme={customTheme}
201
136
  classes={classes}
202
137
  section={config.name}
@@ -209,7 +144,6 @@ const initTblState = (initailState) => ({
209
144
  queryVariables={activeFilters}
210
145
  totalRowCount={dashboardStats[config.count]}
211
146
  activeTab={activeTab}
212
- paginationOptions={paginationOptions}
213
147
  />
214
148
  </Grid>
215
149
  </Grid>
@@ -238,7 +172,7 @@ Wrapper component around table compnent.
238
172
  * Configuration display component based on index
239
173
  * CAUTION: If table is in wrapper component provide position of table component
240
174
  */
241
- export const tableLayout = [{
175
+ export const wrapperConfig = [{
242
176
  container: 'buttons',
243
177
  size: 'xl',
244
178
  clsName: 'container_header',
@@ -317,58 +251,3 @@ headerConfig - upper component on the table
317
251
  | tooltipCofig | FALSE | appears on side of the refers button | dashboardTabData/ tooltipContent |
318
252
 
319
253
 
320
- ####
321
-
322
- ## 5 Pagination Configuration:
323
-
324
- ```
325
- import {
326
- TableContext,
327
- onColumnViewChange, // dispact action
328
- onColumnSort, // dispact action
329
- onChangeSortDirection, // dispact action
330
- onRowsPerPageChange, // dispact action
331
- onPageAndTotalCountChange, // dispact action
332
- onPageChange, // dispact action
333
- onRowSeclect, // dispact action
334
- setTotalRowCount, // dispact action
335
- customPaginationAction, // dispact action
336
- } from '@bento-core/paginated-table';
337
-
338
- const tableContext = useContext(TableContext);
339
- const { context } = tableContext;
340
- const { dispatch } = context;
341
-
342
- const paginationOptions = {
343
- customizeOnRowSelect: (event, row) => {
344
- const payload = {
345
- page: 2,
346
- rowPerPage: 10,
347
- ...
348
- };
349
- // updates table state,
350
- dispatch(customPaginationAction(payload));
351
- },
352
- customizeToggleSelectAll: (event, Ids, includeIds) => {}, // Ids - selected ids
353
- customizeSortByColumn: (column, order) => {},
354
- customizeChangePage: (event, newPage) => {},
355
- customizeChangeRowsPerPage: (event) => {},
356
- customizeColumnViewChange: (column) => {},
357
- };
358
-
359
- <TableView
360
- initState={initTblState}
361
- themeConfig={themeConfig}
362
- queryVariables={activeFilters}
363
- totalRowCount={dashboardStats[config.count]}
364
- activeTab={activeTab}
365
- paginationOptions={paginationOptions}
366
- />
367
- ```
368
-
369
- ***More reference***
370
- ```
371
- https://github.com/CBIIT/bento-icdc-frontend/tree/Bento-4.0/src/components/PaginatedTable
372
- ```
373
-
374
- **Code for table view under bento-core/table - please refer to source code for more information**
@@ -79,7 +79,8 @@ const AddAllFilesComponent = props => {
79
79
  open: openAddDialog,
80
80
  onYesClick: addFilesToCart,
81
81
  onNoClick: toggleOpen,
82
- DisplayCustomText: DisplayCustomText
82
+ DisplayCustomText: DisplayCustomText,
83
+ activeFilters: activeFilters
83
84
  }));
84
85
  };
85
86
  var _default = AddAllFilesComponent;
@@ -17,6 +17,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
  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); }
18
18
  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; }
19
19
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20
+ 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; }
21
+ 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; }
22
+ 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; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
24
+ 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); }
20
25
  const AddSelectedFilesController = props => {
21
26
  const {
22
27
  clsName,
@@ -28,7 +33,9 @@ const AddSelectedFilesController = props => {
28
33
  setOpenSnackbar,
29
34
  setAlterDisplay,
30
35
  client,
31
- maxFileLimit = 1000
36
+ maxFileLimit = 1000,
37
+ applyActiveFilter = false,
38
+ activeFilters = {}
32
39
  } = props;
33
40
  const tableContext = (0, _react.useContext)(_ContextProvider.TableContext);
34
41
  const {
@@ -38,10 +45,11 @@ const AddSelectedFilesController = props => {
38
45
  selectedRows = [],
39
46
  dispatch
40
47
  } = context;
41
- const variables = {
48
+ const activeFilterItems = applyActiveFilter ? activeFilters : {};
49
+ const variables = _objectSpread({
42
50
  first: 10000,
43
51
  [dataKey]: selectedRows
44
- };
52
+ }, activeFilterItems);
45
53
  // add selected files id
46
54
  const addSelectedFiles = () => {
47
55
  const fileIds = (0, _WrapperService.getFilesID)({
@@ -16,7 +16,8 @@ function AddToCartDialogView(props) {
16
16
  onNoClick,
17
17
  cartWillFull = false,
18
18
  alertMessage,
19
- DisplayCustomText
19
+ DisplayCustomText,
20
+ activeFilters
20
21
  } = props;
21
22
  if (cartWillFull) {
22
23
  return /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
@@ -31,7 +32,8 @@ function AddToCartDialogView(props) {
31
32
  "aria-describedby": "alert-dialog-description"
32
33
  }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, DisplayCustomText ? /*#__PURE__*/_react.default.createElement(DisplayCustomText, {
33
34
  onYesClick: onYesClick,
34
- onNoClick: onNoClick
35
+ onNoClick: onNoClick,
36
+ activeFilters: activeFilters
35
37
  }) : /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
36
38
  id: "alert-dialog-description"
37
39
  }, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, {
@@ -33,7 +33,7 @@ const SnackbarView = props => {
33
33
  className: "snackBarMessageIcon"
34
34
  }, /*#__PURE__*/_react.default.createElement(_SuccessOutlined.default, null), ' '), /*#__PURE__*/_react.default.createElement("span", {
35
35
  className: "snackBarText"
36
- }, count, ' ', "File(s) successfully added to your cart"))
36
+ }, count, ' ', "File(s) successfully added to My Files."))
37
37
  }));
38
38
  };
39
39
  var _default = SnackbarView;
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-icdc.2",
4
- "description": "### Bento core paginated table design:",
3
+ "version": "1.0.1-icdc.4",
5
4
  "main": "dist/index.js",
6
5
  "scripts": {
7
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -13,11 +12,11 @@
13
12
  "url": "git+https://github.com/CBIIT/bento-frontend.git"
14
13
  },
15
14
  "publishConfig": {
16
- "@model_navigator:registry": "https://registry.npmjs.org/@bento-core/paginated-table"
15
+ "access": "public"
17
16
  },
18
17
  "dependencies": {
19
18
  "@bento-core/cart": "^1.0.0",
20
- "@bento-core/table": "^1.0.0",
19
+ "@bento-core/table": "1.0.1-icdc.0",
21
20
  "@bento-core/tool-tip": "^1.0.0",
22
21
  "@bento-core/util": "^1.0.0"
23
22
  },
@@ -34,5 +33,7 @@
34
33
  "bugs": {
35
34
  "url": "https://github.com/CBIIT/bento-frontend/issues"
36
35
  },
37
- "homepage": "https://github.com/CBIIT/bento-frontend#readme"
36
+ "homepage": "https://github.com/CBIIT/bento-frontend#readme",
37
+ "devDependencies": {},
38
+ "description": ""
38
39
  }
@@ -0,0 +1,253 @@
1
+ # PAGINATED TABLE COMPONENT DESIGN
2
+
3
+ ### Bento core paginated table design:
4
+
5
+ * Use of UseReducer to track table state and local state to display dialog component
6
+ * use of useContext to access table state
7
+ * Limit use of props drilling
8
+ * Core layout defined by Bento Core table component
9
+ * Build on top of Mui table (demo - https://mui.com/material-ui/react-table/#custom-pagination-actions)
10
+ * Apply SOLID principles in react (https://konstantinlebedev.com/solid-in-react/)
11
+
12
+ ## 1 UseReducer configuration
13
+
14
+ ### Generate and integrate redux dispatch actions
15
+ ```
16
+ const initTblState = (initailState) => ({
17
+ ...initailState,
18
+ title: config.name,
19
+ query: config.api,
20
+ dataKey: config.dataKey,
21
+ columns: configColumn(config.columns),
22
+ count: dashboardStats[config.count],
23
+ selectedRows: [],
24
+ tableMsg: config.tableMsg,
25
+ paginationAPIField: config.paginationAPIField,
26
+ sortBy: config.defaultSortField,
27
+ sortOrder: config.defaultSortDirection,
28
+ rowsPerPage: 10,
29
+ page: 0,
30
+ });
31
+ ```
32
+ **Paginated Table Init State TABLE-1**
33
+ | Table State | Required | description | Configuration |
34
+ | :--- | :----:| :----: | ----: |
35
+ | title | TRUE | table name (Case, Sample, Files), required for class name | |
36
+ | query | TRUE | GraphQL Query for paginated Table (e.g. GET_CASES_OVERVIEW_QUERY) | api |
37
+ | dataKey | TRUE | Tracking selected rows (case - dataKey: 'subject_id') | dashboardTabData/tabContainers |
38
+ | columns | TRUE | columns defined by dashboardTabData (tabContainers) | add fucntion attribut customCellRender/customColHeaderRender to configure custom cell (see bento frontend) |
39
+ | count | TRUE | Total row cound for (Cases, Samples, Files), update based on filter event | |
40
+ | selectedRows | TRUE | Tracks selected Rows | |
41
+ | tableMsg | TRUE | Display noMatch Msg | dashboardTabData/tabContainers/tableMsg |
42
+ | theme | FALSE | override style with themeprovider use ClassName provided by bento-core table to apply style (refer to class name table) | |
43
+ | paginationAPIField | TRUE | Access http response data - defined by dashboardTabData (tabContainers) | ```paginationAPIField: 'subjectOverview'```|
44
+ | sortBy | TRUE | default sort column | defaultSortField: 'subject_id',|
45
+ | sortOrder | FALSE | default sort column 'ASC' | ```defaultSortDirection: 'asc',```|
46
+ | rowsPerPage | FALSE | default 10 | |
47
+ | page | FALSE | 0 | |
48
+ | extendedViewConfig | FALSE | extended view of table header component | refer bento-frontend tabContainers, dashboardTabData.js |
49
+
50
+
51
+ ### 2 Importing Component and Configuration
52
+ ```
53
+ import TableView from 'bento-core/PaginationTable/PaginatedTable';
54
+ // active filter json structure
55
+ <TableView
56
+ initState={initTblState}
57
+ themeConfig={themeConfig}
58
+ activeFilters={activeFilters}
59
+ totalRowCount={dashboardStats[config.count]}
60
+ activeTab={activeTab}
61
+ />
62
+ ```
63
+
64
+ **Paginated Table Props Config TABLE-2**
65
+ | Table | Required | description | Configuration |
66
+ | :--- | :----:| :----: | ----: |
67
+ | table state | TRUE | as describe on TABLE-1 | |
68
+ | viewConfig | FALSE | (Optional) table view config, set hide/diaply pagination above table header | |
69
+ | themeConfig | FALSE | override style with themeprovider use ClassName provided by bento-core table to apply style (refer to class name table) | |
70
+ | totalRowCount | TRUE | Total row cound for (Cases, Samples, Files), update based on filter event | |
71
+ | activeTab | TRUE | prevents http call for inactive tabs (dashboard) /set true to myFile cart | |
72
+
73
+ ## 3 Table component themeConfig Configuration
74
+ ```
75
+ export const tblHeader = {
76
+ MuiTableSortLabel: {
77
+ root: {
78
+ ...define style
79
+ },
80
+ },
81
+ };
82
+
83
+ export const tblPgn = {
84
+ MuiTablePagination: {
85
+ root: {
86
+ paddingRight: '50px',
87
+ borderTop: '5px solid #e7e5e5',
88
+ borderBottom: '3px solid #e7e5e5',
89
+ },
90
+ toolbar: {
91
+ minHeight: '45px',
92
+ },
93
+ },
94
+ };
95
+ // define mui styles for table component
96
+ export const themeConfig = {
97
+ tblHeader,
98
+ tblTopPgn,
99
+ tblPgn,
100
+ tblBody,
101
+ };
102
+ ```
103
+
104
+ ## 3 Table state Context provider Configuration
105
+ ```
106
+ Reference - TabPanel.js (bento-frontend)
107
+
108
+ import {
109
+ TableContextProvider,
110
+ TableView,
111
+ Wrapper,
112
+ } from '@bento-core/paginated-table';
113
+
114
+ const initTblState = (initailState) => ({
115
+ ...initailState,
116
+ title: config.name,
117
+ query: config.api,
118
+ paginationAPIField: config.paginationAPIField,
119
+ dataKey: config.dataKey,
120
+ columns: configColumn(config.columns),
121
+ count: dashboardStats[config.count],
122
+ selectedRows: [],
123
+ enableRowSelection: config.enableRowSelection,
124
+ tableMsg: config.tableMsg,
125
+ sortBy: config.defaultSortField,
126
+ sortOrder: config.defaultSortDirection,
127
+ extendedViewConfig: config.extendedViewConfig,
128
+ rowsPerPage: 10,
129
+ page: 0,
130
+ });
131
+
132
+ <TableContextProvider>
133
+ <Wrapper
134
+ wrapConfig={configWrapper(config, wrapperConfig)}
135
+ customTheme={customTheme}
136
+ classes={classes}
137
+ section={config.name}
138
+ >
139
+ <Grid container>
140
+ <Grid item xs={12} id={config.tableID}>
141
+ <TableView
142
+ initState={initTblState}
143
+ themeConfig={themeConfig}
144
+ queryVariables={activeFilters}
145
+ totalRowCount={dashboardStats[config.count]}
146
+ activeTab={activeTab}
147
+ />
148
+ </Grid>
149
+ </Grid>
150
+ </Wrapper>
151
+ </TableContextProvider>
152
+
153
+ //child component
154
+
155
+ import { TableContext } from 'bento-core';
156
+
157
+ const tableContext = useContext(TableContext);
158
+
159
+ ```
160
+ TableContextProvider provides table state to Wrapper Component or it can be used in higher parent component as needed.
161
+
162
+ ####
163
+
164
+ ## 4 Wrapper Configuration:
165
+ Wrapper component around table compnent.
166
+ 1. ADD ALL FILES button
167
+ 2. ADD SELECTED ROWS button
168
+ 3. Go to My File link
169
+
170
+ ```
171
+ /**
172
+ * Configuration display component based on index
173
+ * CAUTION: If table is in wrapper component provide position of table component
174
+ */
175
+ export const wrapperConfig = [{
176
+ container: 'buttons',
177
+ size: 'xl',
178
+ clsName: 'container_header',
179
+ items: [
180
+ {
181
+ title: 'ADD ALL FILES',
182
+ clsName: 'add_all_button',
183
+ type: types.BUTTON,
184
+ role: btnTypes.ADD_ALL_FILES,
185
+ btnType: btnTypes.ADD_ALL_FILES,
186
+ conditional: false,
187
+ alertMessage,
188
+ },
189
+ {
190
+ title: 'ADD SELECTED FILES',
191
+ clsName: 'add_selected_button',
192
+ type: types.BUTTON,
193
+ role: btnTypes.ADD_SELECTED_FILES,
194
+ btnType: btnTypes.ADD_SELECTED_FILES,
195
+ tooltipCofig: tooltipContent,
196
+ conditional: true,
197
+ }],
198
+ },
199
+ {
200
+ container: 'paginatedTable',
201
+ paginatedTable: true,
202
+ },
203
+ {
204
+ container: 'buttons',
205
+ size: 'xl',
206
+ clsName: 'container_footer',
207
+ items: [
208
+ {
209
+ title: 'ADD SELECTED FILES',
210
+ clsName: 'add_selected_button',
211
+ type: types.BUTTON,
212
+ role: btnTypes.ADD_SELECTED_FILES,
213
+ btnType: btnTypes.ADD_SELECTED_FILES,
214
+ tooltipCofig: tooltipContent,
215
+ conditional: true,
216
+ }],
217
+ },
218
+ {
219
+ container: 'buttons',
220
+ size: 'xl',
221
+ clsName: 'container_footer_link',
222
+ items: [
223
+ {
224
+ title: 'Go to Cart >',
225
+ clsName: 'go_to_cart',
226
+ url: '#/fileCentricCart',
227
+ type: types.LINK,
228
+ }],
229
+ },
230
+ ];
231
+ ```
232
+
233
+ Each item in headerConfig and footerConfig represent container
234
+ **container Config TABLE-3**
235
+ headerConfig - upper component on the table
236
+ footerConfig - button component on the table
237
+ | Attris | Required | description | Configuration |
238
+ | :--- | :----:| :----: | ----: |
239
+ | container | TRUE | describe container | |
240
+ | size | TRUE | container size | xl, md, sm |
241
+ | clsName | TRUE | class name to apply style using themeprovider | |
242
+ | item | TRUE | number of button component ***(refer to table 4)*** | |
243
+
244
+ **Button component Config TABLE-4**
245
+ headerConfig - upper component on the table
246
+ | Attris | Required | description | Configuration |
247
+ | :--- | :----:| :----: | ----: |
248
+ | title | TRUE | button label | 'ADD SELECTED FILES' |
249
+ | clsName | TRUE | class name to apply style using themeprovider | |
250
+ | type | TRUE | add all files or add selected files| btnTypes.ADD_SELECTED_FILES |
251
+ | tooltipCofig | FALSE | appears on side of the refers button | dashboardTabData/ tooltipContent |
252
+
253
+
@@ -79,6 +79,7 @@ const AddAllFilesComponent = (props) => {
79
79
  onYesClick={addFilesToCart}
80
80
  onNoClick={toggleOpen}
81
81
  DisplayCustomText={DisplayCustomText}
82
+ activeFilters={activeFilters}
82
83
  />
83
84
  </>
84
85
  );
@@ -20,6 +20,8 @@ const AddSelectedFilesController = (props) => {
20
20
  setAlterDisplay,
21
21
  client,
22
22
  maxFileLimit = 1000,
23
+ applyActiveFilter = false,
24
+ activeFilters = {},
23
25
  } = props;
24
26
 
25
27
  const tableContext = useContext(TableContext);
@@ -28,9 +30,12 @@ const AddSelectedFilesController = (props) => {
28
30
  selectedRows = [],
29
31
  dispatch,
30
32
  } = context;
33
+
34
+ const activeFilterItems = applyActiveFilter ? activeFilters : {};
31
35
  const variables = {
32
36
  first: 10000,
33
37
  [dataKey]: selectedRows,
38
+ ...activeFilterItems,
34
39
  };
35
40
  // add selected files id
36
41
  const addSelectedFiles = () => {
@@ -13,6 +13,7 @@ function AddToCartDialogView(props) {
13
13
  cartWillFull = false,
14
14
  alertMessage,
15
15
  DisplayCustomText,
16
+ activeFilters,
16
17
  } = props;
17
18
 
18
19
  if (cartWillFull) {
@@ -38,6 +39,7 @@ function AddToCartDialogView(props) {
38
39
  <DisplayCustomText
39
40
  onYesClick={onYesClick}
40
41
  onNoClick={onNoClick}
42
+ activeFilters={activeFilters}
41
43
  />
42
44
  ) : (
43
45
  <DialogContentText id="alert-dialog-description">
@@ -31,7 +31,7 @@ const SnackbarView = (props) => {
31
31
  <span className="snackBarText">
32
32
  {count}
33
33
  {' '}
34
- File(s) successfully added to your cart
34
+ File(s) successfully added to My Files.
35
35
  </span>
36
36
  </div>
37
37
  )}