@bento-core/paginated-table 1.0.1-icdc.3 → 1.0.1-icdc.5

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
+ ```
@@ -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,12 @@ const AddSelectedFilesController = props => {
38
45
  selectedRows = [],
39
46
  dispatch
40
47
  } = context;
41
- const variables = {
42
- first: 10000,
48
+ const activeFilterItems = applyActiveFilter ? _objectSpread({}, activeFilters) : {};
49
+ const variables = _objectSpread(_objectSpread({
50
+ first: 10000
51
+ }, activeFilterItems), {}, {
43
52
  [dataKey]: selectedRows
44
- };
53
+ });
45
54
  // add selected files id
46
55
  const addSelectedFiles = () => {
47
56
  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, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-icdc.3",
3
+ "version": "1.0.1-icdc.5",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
@@ -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,8 +30,14 @@ const AddSelectedFilesController = (props) => {
28
30
  selectedRows = [],
29
31
  dispatch,
30
32
  } = context;
33
+
34
+ const activeFilterItems = applyActiveFilter ? {
35
+ ...activeFilters,
36
+ } : {};
37
+
31
38
  const variables = {
32
39
  first: 10000,
40
+ ...activeFilterItems,
33
41
  [dataKey]: selectedRows,
34
42
  };
35
43
  // add selected files id
@@ -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">