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

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.
@@ -13,6 +13,67 @@
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
+
16
77
  const initTblState = (initailState) => ({
17
78
  ...initailState,
18
79
  title: config.name,
@@ -25,6 +86,7 @@ const initTblState = (initailState) => ({
25
86
  paginationAPIField: config.paginationAPIField,
26
87
  sortBy: config.defaultSortField,
27
88
  sortOrder: config.defaultSortDirection,
89
+ columnGroups: config.columnGroups
28
90
  rowsPerPage: 10,
29
91
  page: 0,
30
92
  });
@@ -45,7 +107,9 @@ const initTblState = (initailState) => ({
45
107
  | sortOrder | FALSE | default sort column 'ASC' | ```defaultSortDirection: 'asc',```|
46
108
  | rowsPerPage | FALSE | default 10 | |
47
109
  | page | FALSE | 0 | |
48
- | extendedViewConfig | FALSE | extended view of table header component | refer bento-frontend tabContainers, dashboardTabData.js |
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
+
49
113
 
50
114
 
51
115
  ### 2 Importing Component and Configuration
@@ -125,13 +189,14 @@ const initTblState = (initailState) => ({
125
189
  sortBy: config.defaultSortField,
126
190
  sortOrder: config.defaultSortDirection,
127
191
  extendedViewConfig: config.extendedViewConfig,
192
+ columnGroups: config.columnGroups,
128
193
  rowsPerPage: 10,
129
194
  page: 0,
130
195
  });
131
196
 
132
197
  <TableContextProvider>
133
198
  <Wrapper
134
- wrapConfig={configWrapper(config, wrapperConfig)}
199
+ wrapConfig={configWrapper(tableLayout)} // tableLayout - refer to step #4
135
200
  customTheme={customTheme}
136
201
  classes={classes}
137
202
  section={config.name}
@@ -144,6 +209,7 @@ const initTblState = (initailState) => ({
144
209
  queryVariables={activeFilters}
145
210
  totalRowCount={dashboardStats[config.count]}
146
211
  activeTab={activeTab}
212
+ paginationOptions={paginationOptions}
147
213
  />
148
214
  </Grid>
149
215
  </Grid>
@@ -172,7 +238,7 @@ Wrapper component around table compnent.
172
238
  * Configuration display component based on index
173
239
  * CAUTION: If table is in wrapper component provide position of table component
174
240
  */
175
- export const wrapperConfig = [{
241
+ export const tableLayout = [{
176
242
  container: 'buttons',
177
243
  size: 'xl',
178
244
  clsName: 'container_header',
@@ -251,3 +317,58 @@ headerConfig - upper component on the table
251
317
  | tooltipCofig | FALSE | appears on side of the refers button | dashboardTabData/ tooltipContent |
252
318
 
253
319
 
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**
@@ -46,10 +46,12 @@ const AddSelectedFilesController = props => {
46
46
  dispatch
47
47
  } = context;
48
48
  const activeFilterItems = applyActiveFilter ? activeFilters : {};
49
- const variables = _objectSpread({
50
- first: 10000,
49
+ const variables = _objectSpread(_objectSpread({
50
+ first: 10000
51
+ }, activeFilterItems), {
51
52
  [dataKey]: selectedRows
52
- }, activeFilterItems);
53
+ });
54
+
53
55
  // add selected files id
54
56
  const addSelectedFiles = () => {
55
57
  const fileIds = (0, _WrapperService.getFilesID)({
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-icdc.4",
3
+ "version": "1.0.1-icdc.6",
4
+ "description": "### Bento core paginated table design:",
4
5
  "main": "dist/index.js",
5
6
  "scripts": {
6
7
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -16,7 +17,7 @@
16
17
  },
17
18
  "dependencies": {
18
19
  "@bento-core/cart": "^1.0.0",
19
- "@bento-core/table": "1.0.1-icdc.0",
20
+ "@bento-core/table": "^1.0.0",
20
21
  "@bento-core/tool-tip": "^1.0.0",
21
22
  "@bento-core/util": "^1.0.0"
22
23
  },
@@ -34,6 +35,5 @@
34
35
  "url": "https://github.com/CBIIT/bento-frontend/issues"
35
36
  },
36
37
  "homepage": "https://github.com/CBIIT/bento-frontend#readme",
37
- "devDependencies": {},
38
- "description": ""
38
+ "devDependencies": {}
39
39
  }
@@ -32,11 +32,13 @@ const AddSelectedFilesController = (props) => {
32
32
  } = context;
33
33
 
34
34
  const activeFilterItems = applyActiveFilter ? activeFilters : {};
35
+
35
36
  const variables = {
36
37
  first: 10000,
37
- [dataKey]: selectedRows,
38
38
  ...activeFilterItems,
39
+ ...{ [dataKey]: selectedRows },
39
40
  };
41
+
40
42
  // add selected files id
41
43
  const addSelectedFiles = () => {
42
44
  const fileIds = getFilesID({