@bento-core/paginated-table 1.0.1-ins.8 → 1.0.1-popsci.0

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 (36) hide show
  1. package/dist/index.js +0 -13
  2. package/dist/table/ClientController.js +0 -1
  3. package/dist/table/PaginatedTable.js +14 -25
  4. package/dist/table/state/Actions.js +3 -9
  5. package/dist/table/state/Reducer.js +0 -2
  6. package/dist/wrapper/Wrapper.js +2 -4
  7. package/dist/wrapper/WrapperService.js +1 -1
  8. package/dist/wrapper/components/AddAllFiles/AddAllView.js +13 -12
  9. package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +5 -18
  10. package/dist/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +0 -3
  11. package/dist/wrapper/components/AddToCartDialog/AddToCartDialogView.js +3 -11
  12. package/dist/wrapper/components/DownloadManifestBtn.js +4 -21
  13. package/dist/wrapper/components/ReduxAddFile.js +0 -2
  14. package/dist/wrapper/components/Snackbar/Snackbar.js +1 -1
  15. package/dist/wrapper/components/TooltipView.js +0 -2
  16. package/package.json +6 -13
  17. package/src/index.js +0 -4
  18. package/src/table/ClientController.js +0 -1
  19. package/src/table/PaginatedTable.js +13 -24
  20. package/src/table/state/Actions.js +0 -6
  21. package/src/table/state/Reducer.js +0 -5
  22. package/src/wrapper/Wrapper.js +0 -2
  23. package/src/wrapper/WrapperService.js +1 -1
  24. package/src/wrapper/components/AddAllFiles/AddAllView.js +10 -10
  25. package/src/wrapper/components/AddSelectedFiles/AddSelectedFilesController.js +4 -17
  26. package/src/wrapper/components/AddSelectedFiles/AddSelectedFilesView.js +1 -2
  27. package/src/wrapper/components/AddToCartDialog/AddToCartDialogView.js +8 -20
  28. package/src/wrapper/components/DownloadManifestBtn.js +3 -28
  29. package/src/wrapper/components/ReduxAddFile.js +0 -1
  30. package/src/wrapper/components/Snackbar/Snackbar.js +1 -1
  31. package/src/wrapper/components/TextFieldView.js +0 -1
  32. package/src/wrapper/components/TooltipView.js +0 -1
  33. package/Add_ALL_Files__BLUE_ButtonREADME.md +0 -86
  34. package/Add_Selected_Files_Orange_button_README.md +0 -79
  35. package/dist/wrapper/components/util.js +0 -33
  36. package/src/wrapper/components/util.js +0 -26
package/dist/index.js CHANGED
@@ -3,12 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "ButtonView", {
7
- enumerable: true,
8
- get: function get() {
9
- return _ButtonView.default;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "TableContext", {
13
7
  enumerable: true,
14
8
  get: function get() {
@@ -39,12 +33,6 @@ Object.defineProperty(exports, "btnTypes", {
39
33
  return _AddFiles.btnTypes;
40
34
  }
41
35
  });
42
- Object.defineProperty(exports, "customPaginationAction", {
43
- enumerable: true,
44
- get: function get() {
45
- return _Actions.customPaginationAction;
46
- }
47
- });
48
36
  Object.defineProperty(exports, "getQueryVariables", {
49
37
  enumerable: true,
50
38
  get: function get() {
@@ -111,7 +99,6 @@ var _Actions = require("./table/state/Actions");
111
99
  var _Wrapper = _interopRequireWildcard(require("./wrapper/Wrapper"));
112
100
  var _AddFiles = require("./wrapper/components/AddFiles");
113
101
  var _WrapperService = require("./wrapper/WrapperService");
114
- var _ButtonView = _interopRequireDefault(require("./wrapper/components/ButtonView"));
115
102
  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); }
116
103
  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; }
117
104
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -57,7 +57,6 @@ const TableController = props => {
57
57
  const endIndex = startIndex + rowsPerPage;
58
58
  const displayRows = [...sortedRows].slice(startIndex, endIndex);
59
59
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_table.TableView, _extends({}, props, {
60
- totalRows: tblRows,
61
60
  tableRows: displayRows
62
61
  })));
63
62
  };
@@ -26,8 +26,7 @@ const PaginatedTable = _ref => {
26
26
  initState,
27
27
  activeTab = true,
28
28
  server = true,
29
- tblRows = [],
30
- paginationOptions = {}
29
+ tblRows = []
31
30
  } = _ref;
32
31
  /**
33
32
  * Initailize useReducer state
@@ -90,15 +89,6 @@ const PaginatedTable = _ref => {
90
89
  pageNumb: newPage
91
90
  }));
92
91
  };
93
- // custonize pagination behavior
94
- const {
95
- customizeOnRowSelect,
96
- customizeToggleSelectAll,
97
- customizeSortByColumn,
98
- customizeChangePage,
99
- customizeChangeRowsPerPage,
100
- customizeColumnViewChange
101
- } = paginationOptions;
102
92
 
103
93
  /**
104
94
  * update selected Ids
@@ -148,7 +138,7 @@ const PaginatedTable = _ref => {
148
138
  const handleColumnViewChange = column => {
149
139
  const columns = table.columns.map(col => {
150
140
  const updateColumnView = _objectSpread({}, col);
151
- if (col.dataField && col.dataField === column.dataField) {
141
+ if (col.dataField === column.dataField) {
152
142
  updateColumnView.display = !column.display;
153
143
  }
154
144
  return updateColumnView;
@@ -166,12 +156,12 @@ const PaginatedTable = _ref => {
166
156
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClientController.default, {
167
157
  tblRows: tblRows,
168
158
  table: table,
169
- onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
170
- onPageChange: customizeChangePage || handleChangePage,
171
- onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
172
- onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
173
- onSortByColumn: customizeSortByColumn || handleSortByColumn,
174
- onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
159
+ onRowsPerPageChange: handleChangeRowsPerPage,
160
+ onPageChange: handleChangePage,
161
+ onRowSelectChange: onRowSelectHandler,
162
+ onToggleSelectAll: handleToggleSelectAll,
163
+ onSortByColumn: handleSortByColumn,
164
+ onColumnViewChange: handleColumnViewChange,
175
165
  themeConfig: themeConfig
176
166
  }));
177
167
  }
@@ -190,13 +180,12 @@ const PaginatedTable = _ref => {
190
180
  queryVariables: queryVariables,
191
181
  totalRowCount: totalRowCount,
192
182
  table: table,
193
- server: server,
194
- onRowsPerPageChange: customizeChangeRowsPerPage || handleChangeRowsPerPage,
195
- onPageChange: customizeChangePage || handleChangePage,
196
- onRowSelectChange: customizeOnRowSelect || onRowSelectHandler,
197
- onToggleSelectAll: customizeToggleSelectAll || handleToggleSelectAll,
198
- onSortByColumn: customizeSortByColumn || handleSortByColumn,
199
- onColumnViewChange: customizeColumnViewChange || handleColumnViewChange,
183
+ onRowsPerPageChange: handleChangeRowsPerPage,
184
+ onPageChange: handleChangePage,
185
+ onRowSelectChange: onRowSelectHandler,
186
+ onToggleSelectAll: handleToggleSelectAll,
187
+ onSortByColumn: handleSortByColumn,
188
+ onColumnViewChange: handleColumnViewChange,
200
189
  themeConfig: themeConfig
201
190
  }));
202
191
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.customPaginationAction = exports.actionTypes = void 0;
6
+ exports.setTotalRowCount = exports.onRowsPerPageChange = exports.onRowSeclect = exports.onPageChange = exports.onPageAndTotalCountChange = exports.onColumnViewChange = exports.onColumnSort = exports.onChangeSortDirection = exports.actionTypes = void 0;
7
7
  const actionTypes = {
8
8
  VIEW_COLUMN_CHANGE: 'VIEW_COLUMN_CHANGE',
9
9
  ON_COLUMN_SORT: 'ON_COLUMN_SORT',
@@ -12,8 +12,7 @@ const actionTypes = {
12
12
  ON_PAGE_CHANGE: 'ON_PAGE_CHANGE',
13
13
  ON_ROW_SELECT: 'ON_ROW_SELECT',
14
14
  SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
15
- ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
16
- CUSTOMIZE_PAGINATION_ACTION: 'CUSTOMIZE_PAGINATION_ACTION'
15
+ ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE'
17
16
  };
18
17
  exports.actionTypes = actionTypes;
19
18
  const onColumnViewChange = columns => ({
@@ -55,9 +54,4 @@ const setTotalRowCount = count => ({
55
54
  type: actionTypes.SET_TOTAL_ROW_COUNT,
56
55
  payload: count
57
56
  });
58
- exports.setTotalRowCount = setTotalRowCount;
59
- const customPaginationAction = value => ({
60
- type: actionTypes.CUSTOMIZE_PAGINATION_ACTION,
61
- payload: value
62
- });
63
- exports.customPaginationAction = customPaginationAction;
57
+ exports.setTotalRowCount = setTotalRowCount;
@@ -16,8 +16,6 @@ const reducer = (state, action) => {
16
16
  payload
17
17
  } = action;
18
18
  switch (type) {
19
- case _Actions.actionTypes.CUSTOMIZE_PAGINATION_ACTION:
20
- return _objectSpread(_objectSpread({}, state), payload);
21
19
  case _Actions.actionTypes.ON_COLUMN_SORT:
22
20
  return _objectSpread(_objectSpread({}, state), {}, {
23
21
  sortOrder: payload.sort,
@@ -152,8 +152,7 @@ const CustomWrapper = props => {
152
152
  section,
153
153
  classes,
154
154
  activeFilters,
155
- tblDispatch,
156
- totalRowCount
155
+ tblDispatch
157
156
  } = props;
158
157
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(CustomLayout, {
159
158
  configs: wrapConfig,
@@ -161,8 +160,7 @@ const CustomWrapper = props => {
161
160
  section: section,
162
161
  classes: classes,
163
162
  activeFilters: activeFilters,
164
- tblDispatch: tblDispatch,
165
- totalRowCount: totalRowCount
163
+ tblDispatch: tblDispatch
166
164
  }, children));
167
165
  };
168
166
  var _default = CustomWrapper;
@@ -14,7 +14,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
14
14
  */
15
15
  const getQueryVariables = variables => {
16
16
  const queryVariables = _objectSpread({}, variables);
17
- queryVariables.first = 10000;
17
+ queryVariables.first = 100000;
18
18
  return queryVariables;
19
19
  };
20
20
  exports.getQueryVariables = getQueryVariables;
@@ -9,8 +9,6 @@ var _core = require("@material-ui/core");
9
9
  var _clsx = _interopRequireDefault(require("clsx"));
10
10
  var _WrapperService = require("../../WrapperService");
11
11
  var _AddToCartDialogView = _interopRequireDefault(require("../AddToCartDialog/AddToCartDialogView"));
12
- var _TooltipView = _interopRequireDefault(require("../TooltipView"));
13
- var _util = _interopRequireDefault(require("../util"));
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
13
  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
14
  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; }
@@ -25,10 +23,7 @@ const AddAllFilesComponent = props => {
25
23
  addFiles,
26
24
  setAlterDisplay,
27
25
  setOpenSnackbar,
28
- client,
29
- tooltipCofig,
30
- maxFileLimit = 1000,
31
- DisplayCustomText
26
+ client
32
27
  } = props;
33
28
  /**
34
29
  * conditionally display dialog view
@@ -49,8 +44,16 @@ const AddAllFilesComponent = props => {
49
44
  fileIds().then(response => {
50
45
  const data = response[responseKeys[0]];
51
46
  if (data && data.length > 0) {
52
- const ids = (0, _util.default)(response, responseKeys);
53
- if (ids.length > maxFileLimit) {
47
+ const isArray = Array.isArray(data[0][responseKeys[1]]);
48
+ const ids = data.reduce((acc, id) => {
49
+ if (id && id[responseKeys[1]]) {
50
+ // if object convert to array
51
+ const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
52
+ acc.push(...items);
53
+ }
54
+ return acc;
55
+ }, []);
56
+ if (ids.length > 1000) {
54
57
  setAlterDisplay(true);
55
58
  } else {
56
59
  setOpen(true);
@@ -75,12 +78,10 @@ const AddAllFilesComponent = props => {
75
78
  onClick: addAllFiles,
76
79
  className: (0, _clsx.default)(clsName, "".concat(clsName, "_").concat(section)),
77
80
  disableRipple: true
78
- }, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), /*#__PURE__*/_react.default.createElement(_AddToCartDialogView.default, {
81
+ }, title), /*#__PURE__*/_react.default.createElement(_AddToCartDialogView.default, {
79
82
  open: openAddDialog,
80
83
  onYesClick: addFilesToCart,
81
- onNoClick: toggleOpen,
82
- DisplayCustomText: DisplayCustomText,
83
- activeFilters: activeFilters
84
+ onNoClick: toggleOpen
84
85
  }));
85
86
  };
86
87
  var _default = AddAllFilesComponent;
@@ -12,16 +12,10 @@ var _ContextProvider = require("../../../table/ContextProvider");
12
12
  var _Actions = require("../../../table/state/Actions");
13
13
  var _AddSelectedFilesView = _interopRequireDefault(require("./AddSelectedFilesView"));
14
14
  var _WrapperService = require("../../WrapperService");
15
- var _util = _interopRequireDefault(require("../util"));
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
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); }
18
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; }
19
18
  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); }
25
19
  const AddSelectedFilesController = props => {
26
20
  const {
27
21
  clsName,
@@ -32,10 +26,7 @@ const AddSelectedFilesController = props => {
32
26
  addFiles,
33
27
  setOpenSnackbar,
34
28
  setAlterDisplay,
35
- client,
36
- maxFileLimit = 1000,
37
- applyActiveFilter = false,
38
- activeFilters = {}
29
+ client
39
30
  } = props;
40
31
  const tableContext = (0, _react.useContext)(_ContextProvider.TableContext);
41
32
  const {
@@ -45,12 +36,8 @@ const AddSelectedFilesController = props => {
45
36
  selectedRows = [],
46
37
  dispatch
47
38
  } = context;
48
- const activeFilterItems = applyActiveFilter ? _objectSpread({}, activeFilters) : {};
49
- const variables = _objectSpread(_objectSpread({
50
- first: 10000
51
- }, activeFilterItems), {}, {
52
- [dataKey]: selectedRows
53
- });
39
+ const variables = {};
40
+ variables[dataKey] = selectedRows;
54
41
  // add selected files id
55
42
  const addSelectedFiles = () => {
56
43
  const fileIds = (0, _WrapperService.getFilesID)({
@@ -60,8 +47,8 @@ const AddSelectedFilesController = props => {
60
47
  query: addFileQuery
61
48
  });
62
49
  fileIds().then(response => {
63
- const ids = (0, _util.default)(response, responseKeys);
64
- if (ids.length >= maxFileLimit) {
50
+ const ids = response[responseKeys[0]] || [];
51
+ if (ids.length >= 1000) {
65
52
  setAlterDisplay(true);
66
53
  } else {
67
54
  addFiles(ids);
@@ -8,8 +8,6 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _core = require("@material-ui/core");
9
9
  var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- // eslint-disable-next-line import/no-unresolved
12
-
13
11
  /**
14
12
  * customize tooltips based on tooltipContent
15
13
  * defined on dashboardTabData (tooltipContent)
@@ -37,7 +35,6 @@ const ToolTipView = props => {
37
35
  arrow: classes.customArrow
38
36
  }
39
37
  }, /*#__PURE__*/_react.default.createElement("img", {
40
- className: "add_selected_file_tooltip_icon",
41
38
  src: icon || src,
42
39
  alt: alt
43
40
  }));
@@ -15,9 +15,7 @@ function AddToCartDialogView(props) {
15
15
  onYesClick,
16
16
  onNoClick,
17
17
  cartWillFull = false,
18
- alertMessage,
19
- DisplayCustomText,
20
- activeFilters
18
+ alertMessage
21
19
  } = props;
22
20
  if (cartWillFull) {
23
21
  return /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
@@ -30,15 +28,9 @@ function AddToCartDialogView(props) {
30
28
  open: open,
31
29
  "aria-labelledby": "alert-dialog-title",
32
30
  "aria-describedby": "alert-dialog-description"
33
- }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, DisplayCustomText ? /*#__PURE__*/_react.default.createElement(DisplayCustomText, {
34
- onYesClick: onYesClick,
35
- onNoClick: onNoClick,
36
- activeFilters: activeFilters
37
- }) : /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
31
+ }, /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, /*#__PURE__*/_react.default.createElement(_core.DialogContentText, {
38
32
  id: "alert-dialog-description"
39
- }, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, {
40
- className: "dialog_actions"
41
- }, /*#__PURE__*/_react.default.createElement(_core.Button, {
33
+ }, "Are you sure to add All Files", ' ', numberOfFilesSelected, ' ', "to cart")), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
42
34
  className: "yesBtn",
43
35
  onClick: () => onYesClick()
44
36
  }, "Yes"), /*#__PURE__*/_react.default.createElement(_core.Button, {
@@ -21,15 +21,8 @@ const DownloadManifestView = props => {
21
21
  const {
22
22
  tooltipCofig,
23
23
  clsName,
24
- title,
25
- totalRowCount
24
+ title
26
25
  } = props;
27
- const {
28
- icon,
29
- alt,
30
- arrow = false,
31
- clsName: toolTipClsName
32
- } = tooltipCofig;
33
26
  /**
34
27
  * get cart state
35
28
  */
@@ -55,7 +48,7 @@ const DownloadManifestView = props => {
55
48
  const fetchResult = await client.query({
56
49
  query: table.api,
57
50
  variables: _objectSpread({}, getQueryVeriables(queryVariables))
58
- }).then(result => table.objectKey ? result.data[table.objectKey] : result.data.filesInList);
51
+ }).then(result => result.data.filesInList);
59
52
  return fetchResult;
60
53
  }
61
54
  async function DocumentDownload() {
@@ -74,18 +67,8 @@ const DownloadManifestView = props => {
74
67
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
75
68
  className: clsName,
76
69
  disableRipple: true,
77
- onClick: () => DocumentDownload(),
78
- disabled: totalRowCount === 0
79
- }, title), tooltipCofig && !tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props), tooltipCofig && tooltipCofig.customToolTipComponent && /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
80
- arrow: arrow,
81
- interactive: true,
82
- title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipCofig.customToolTipComponent),
83
- placement: "bottom"
84
- }, icon && /*#__PURE__*/_react.default.createElement("img", {
85
- src: icon,
86
- alt: alt,
87
- className: toolTipClsName
88
- })));
70
+ onClick: () => DocumentDownload()
71
+ }, title), tooltipCofig && /*#__PURE__*/_react.default.createElement(_TooltipView.default, props));
89
72
  };
90
73
  var _default = DownloadManifestView;
91
74
  exports.default = _default;
@@ -9,8 +9,6 @@ var _reactRedux = require("react-redux");
9
9
  var _cart = require("@bento-core/cart");
10
10
  var _AddFiles = _interopRequireDefault(require("./AddFiles"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- // eslint-disable-next-line import/no-unresolved
13
-
14
12
  const AddFilesRedux = props => /*#__PURE__*/_react.default.createElement(_AddFiles.default, props);
15
13
 
16
14
  /**
@@ -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 My Files."))
36
+ }, count, ' ', "File(s) successfully added to your cart"))
37
37
  }));
38
38
  };
39
39
  var _default = SnackbarView;
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- // eslint-disable-next-line import/no-unresolved
11
-
12
10
  /**
13
11
  * customize tooltips based on tooltipContent
14
12
  * defined on dashboardTabData (tooltipContent)
package/package.json CHANGED
@@ -1,24 +1,22 @@
1
1
  {
2
2
  "name": "@bento-core/paginated-table",
3
- "version": "1.0.1-ins.8",
3
+ "version": "1.0.1-popsci.0",
4
+ "description": "",
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",
7
8
  "test": "echo \"Error: no test specified\" && exit 1",
8
9
  "lint": "eslint src"
9
10
  },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/CBIIT/bento-frontend.git"
13
- },
11
+ "repository": "https://github.com/CBIIT/bento-frontend",
14
12
  "publishConfig": {
15
13
  "access": "public"
16
14
  },
17
15
  "dependencies": {
18
16
  "@bento-core/cart": "^1.0.0",
19
- "@bento-core/table": "1.0.1-ins.8",
17
+ "@bento-core/table": "^1.0.1-popsci.0",
20
18
  "@bento-core/tool-tip": "^1.0.0",
21
- "@bento-core/util": "1.0.1-ins.0"
19
+ "@bento-core/util": "^1.0.0"
22
20
  },
23
21
  "peerDependencies": {
24
22
  "@apollo/client": "^3.6.9",
@@ -30,10 +28,5 @@
30
28
  },
31
29
  "author": "CTOS Bento Team",
32
30
  "license": "ISC",
33
- "bugs": {
34
- "url": "https://github.com/CBIIT/bento-frontend/issues"
35
- },
36
- "homepage": "https://github.com/CBIIT/bento-frontend#readme",
37
- "devDependencies": {},
38
- "description": ""
31
+ "gitHead": "c8f3272107a251009045c9c0fdbebcc47c0c266a"
39
32
  }
package/src/index.js CHANGED
@@ -12,11 +12,7 @@ export {
12
12
  onPageChange,
13
13
  onRowSeclect,
14
14
  setTotalRowCount,
15
- customPaginationAction,
16
15
  } from './table/state/Actions';
17
16
  export { default as Wrapper, types } from './wrapper/Wrapper';
18
17
  export { btnTypes } from './wrapper/components/AddFiles';
19
18
  export { getQueryVariables } from './wrapper/WrapperService';
20
- export {
21
- default as ButtonView,
22
- } from './wrapper/components/ButtonView';
@@ -55,7 +55,6 @@ const TableController = ((props) => {
55
55
  <>
56
56
  <TableView
57
57
  {...props}
58
- totalRows={tblRows}
59
58
  tableRows={displayRows}
60
59
  />
61
60
  </>
@@ -21,7 +21,6 @@ const PaginatedTable = ({
21
21
  activeTab = true,
22
22
  server = true,
23
23
  tblRows = [],
24
- paginationOptions = {},
25
24
  }) => {
26
25
  /**
27
26
  * Initailize useReducer state
@@ -75,15 +74,6 @@ const PaginatedTable = ({
75
74
  const handleChangePage = (event, newPage) => {
76
75
  dispatch(onPageChange({ pageNumb: newPage }));
77
76
  };
78
- // custonize pagination behavior
79
- const {
80
- customizeOnRowSelect,
81
- customizeToggleSelectAll,
82
- customizeSortByColumn,
83
- customizeChangePage,
84
- customizeChangeRowsPerPage,
85
- customizeColumnViewChange,
86
- } = paginationOptions;
87
77
 
88
78
  /**
89
79
  * update selected Ids
@@ -130,7 +120,7 @@ const PaginatedTable = ({
130
120
  const handleColumnViewChange = (column) => {
131
121
  const columns = table.columns.map((col) => {
132
122
  const updateColumnView = { ...col };
133
- if (col.dataField && col.dataField === column.dataField) {
123
+ if (col.dataField === column.dataField) {
134
124
  updateColumnView.display = !column.display;
135
125
  }
136
126
  return updateColumnView;
@@ -151,12 +141,12 @@ const PaginatedTable = ({
151
141
  <ClientTableView
152
142
  tblRows={tblRows}
153
143
  table={table}
154
- onRowsPerPageChange={customizeChangeRowsPerPage || handleChangeRowsPerPage}
155
- onPageChange={customizeChangePage || handleChangePage}
156
- onRowSelectChange={customizeOnRowSelect || onRowSelectHandler}
157
- onToggleSelectAll={customizeToggleSelectAll || handleToggleSelectAll}
158
- onSortByColumn={customizeSortByColumn || handleSortByColumn}
159
- onColumnViewChange={customizeColumnViewChange || handleColumnViewChange}
144
+ onRowsPerPageChange={handleChangeRowsPerPage}
145
+ onPageChange={handleChangePage}
146
+ onRowSelectChange={onRowSelectHandler}
147
+ onToggleSelectAll={handleToggleSelectAll}
148
+ onSortByColumn={handleSortByColumn}
149
+ onColumnViewChange={handleColumnViewChange}
160
150
  themeConfig={themeConfig}
161
151
  />
162
152
  </>
@@ -180,13 +170,12 @@ const PaginatedTable = ({
180
170
  queryVariables={queryVariables}
181
171
  totalRowCount={totalRowCount}
182
172
  table={table}
183
- server={server}
184
- onRowsPerPageChange={customizeChangeRowsPerPage || handleChangeRowsPerPage}
185
- onPageChange={customizeChangePage || handleChangePage}
186
- onRowSelectChange={customizeOnRowSelect || onRowSelectHandler}
187
- onToggleSelectAll={customizeToggleSelectAll || handleToggleSelectAll}
188
- onSortByColumn={customizeSortByColumn || handleSortByColumn}
189
- onColumnViewChange={customizeColumnViewChange || handleColumnViewChange}
173
+ onRowsPerPageChange={handleChangeRowsPerPage}
174
+ onPageChange={handleChangePage}
175
+ onRowSelectChange={onRowSelectHandler}
176
+ onToggleSelectAll={handleToggleSelectAll}
177
+ onSortByColumn={handleSortByColumn}
178
+ onColumnViewChange={handleColumnViewChange}
190
179
  themeConfig={themeConfig}
191
180
  />
192
181
  </>
@@ -7,7 +7,6 @@ export const actionTypes = {
7
7
  ON_ROW_SELECT: 'ON_ROW_SELECT',
8
8
  SET_TOTAL_ROW_COUNT: 'SET_TOTAL_ROW_COUNT',
9
9
  ON_PAGE_AND_TOTAL_COUNT_CHANGE: 'ON_PAGE_AND_TOTAL_COUNT_CHANGE',
10
- CUSTOMIZE_PAGINATION_ACTION: 'CUSTOMIZE_PAGINATION_ACTION',
11
10
  };
12
11
 
13
12
  export const onColumnViewChange = (columns) => ({
@@ -49,8 +48,3 @@ export const setTotalRowCount = (count) => ({
49
48
  type: actionTypes.SET_TOTAL_ROW_COUNT,
50
49
  payload: count,
51
50
  });
52
-
53
- export const customPaginationAction = (value) => ({
54
- type: actionTypes.CUSTOMIZE_PAGINATION_ACTION,
55
- payload: value,
56
- });
@@ -3,11 +3,6 @@ import { actionTypes } from './Actions';
3
3
  const reducer = (state, action) => {
4
4
  const { type, payload } = action;
5
5
  switch (type) {
6
- case actionTypes.CUSTOMIZE_PAGINATION_ACTION:
7
- return {
8
- ...state,
9
- ...payload,
10
- };
11
6
  case actionTypes.ON_COLUMN_SORT:
12
7
  return {
13
8
  ...state,
@@ -150,7 +150,6 @@ const CustomWrapper = (props) => {
150
150
  classes,
151
151
  activeFilters,
152
152
  tblDispatch,
153
- totalRowCount,
154
153
  } = props;
155
154
  return (
156
155
  <>
@@ -161,7 +160,6 @@ const CustomWrapper = (props) => {
161
160
  classes={classes}
162
161
  activeFilters={activeFilters}
163
162
  tblDispatch={tblDispatch}
164
- totalRowCount={totalRowCount}
165
163
  >
166
164
  {children}
167
165
  </CustomLayout>
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const getQueryVariables = (variables) => {
5
5
  const queryVariables = { ...variables };
6
- queryVariables.first = 10000;
6
+ queryVariables.first = 100000;
7
7
  return queryVariables;
8
8
  };
9
9
 
@@ -3,8 +3,6 @@ import { Button } from '@material-ui/core';
3
3
  import clsx from 'clsx';
4
4
  import { getFilesID } from '../../WrapperService';
5
5
  import AddToCartDialogView from '../AddToCartDialog/AddToCartDialogView';
6
- import ToolTipView from '../TooltipView';
7
- import addFilesResponseHandler from '../util';
8
6
 
9
7
  const AddAllFilesComponent = (props) => {
10
8
  const {
@@ -18,9 +16,6 @@ const AddAllFilesComponent = (props) => {
18
16
  setAlterDisplay,
19
17
  setOpenSnackbar,
20
18
  client,
21
- tooltipCofig,
22
- maxFileLimit = 1000,
23
- DisplayCustomText,
24
19
  } = props;
25
20
  /**
26
21
  * conditionally display dialog view
@@ -41,8 +36,16 @@ const AddAllFilesComponent = (props) => {
41
36
  fileIds().then((response) => {
42
37
  const data = response[responseKeys[0]];
43
38
  if (data && data.length > 0) {
44
- const ids = addFilesResponseHandler(response, responseKeys);
45
- if (ids.length > maxFileLimit) {
39
+ const isArray = Array.isArray(data[0][responseKeys[1]]);
40
+ const ids = data.reduce((acc, id) => {
41
+ if (id && id[responseKeys[1]]) {
42
+ // if object convert to array
43
+ const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
44
+ acc.push(...items);
45
+ }
46
+ return acc;
47
+ }, []);
48
+ if (ids.length > 1000) {
46
49
  setAlterDisplay(true);
47
50
  } else {
48
51
  setOpen(true);
@@ -73,13 +76,10 @@ const AddAllFilesComponent = (props) => {
73
76
  >
74
77
  {title}
75
78
  </Button>
76
- {tooltipCofig && (<ToolTipView {...props} />)}
77
79
  <AddToCartDialogView
78
80
  open={openAddDialog}
79
81
  onYesClick={addFilesToCart}
80
82
  onNoClick={toggleOpen}
81
- DisplayCustomText={DisplayCustomText}
82
- activeFilters={activeFilters}
83
83
  />
84
84
  </>
85
85
  );
@@ -1,13 +1,11 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { connect } from 'react-redux';
3
3
  import clsx from 'clsx';
4
- // eslint-disable-next-line import/no-unresolved
5
4
  import { onAddCartFiles } from '@bento-core/cart';
6
5
  import { TableContext } from '../../../table/ContextProvider';
7
6
  import { onRowSeclect } from '../../../table/state/Actions';
8
7
  import AddSelectedFileComponent from './AddSelectedFilesView';
9
8
  import { getFilesID } from '../../WrapperService';
10
- import addFilesResponseHandler from '../util';
11
9
 
12
10
  const AddSelectedFilesController = (props) => {
13
11
  const {
@@ -20,9 +18,6 @@ const AddSelectedFilesController = (props) => {
20
18
  setOpenSnackbar,
21
19
  setAlterDisplay,
22
20
  client,
23
- maxFileLimit = 1000,
24
- applyActiveFilter = false,
25
- activeFilters = {},
26
21
  } = props;
27
22
 
28
23
  const tableContext = useContext(TableContext);
@@ -31,16 +26,8 @@ const AddSelectedFilesController = (props) => {
31
26
  selectedRows = [],
32
27
  dispatch,
33
28
  } = context;
34
-
35
- const activeFilterItems = applyActiveFilter ? {
36
- ...activeFilters,
37
- } : {};
38
-
39
- const variables = {
40
- first: 10000,
41
- ...activeFilterItems,
42
- [dataKey]: selectedRows,
43
- };
29
+ const variables = {};
30
+ variables[dataKey] = selectedRows;
44
31
  // add selected files id
45
32
  const addSelectedFiles = () => {
46
33
  const fileIds = getFilesID({
@@ -51,8 +38,8 @@ const AddSelectedFilesController = (props) => {
51
38
  });
52
39
 
53
40
  fileIds().then((response) => {
54
- const ids = addFilesResponseHandler(response, responseKeys);
55
- if (ids.length >= maxFileLimit) {
41
+ const ids = response[responseKeys[0]] || [];
42
+ if (ids.length >= 1000) {
56
43
  setAlterDisplay(true);
57
44
  } else {
58
45
  addFiles(ids);
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { Button } from '@material-ui/core';
3
- // eslint-disable-next-line import/no-unresolved
4
3
  import ToolTip from '@bento-core/tool-tip';
5
4
 
6
5
  /**
@@ -31,7 +30,7 @@ export const ToolTipView = (props) => {
31
30
  arrow: classes.customArrow,
32
31
  }}
33
32
  >
34
- <img className="add_selected_file_tooltip_icon" src={icon || src} alt={alt} />
33
+ <img src={icon || src} alt={alt} />
35
34
  </ToolTip>
36
35
  );
37
36
  };
@@ -12,8 +12,6 @@ function AddToCartDialogView(props) {
12
12
  onNoClick,
13
13
  cartWillFull = false,
14
14
  alertMessage,
15
- DisplayCustomText,
16
- activeFilters,
17
15
  } = props;
18
16
 
19
17
  if (cartWillFull) {
@@ -34,25 +32,15 @@ function AddToCartDialogView(props) {
34
32
  aria-describedby="alert-dialog-description"
35
33
  >
36
34
  <DialogContent>
37
- {
38
- DisplayCustomText ? (
39
- <DisplayCustomText
40
- onYesClick={onYesClick}
41
- onNoClick={onNoClick}
42
- activeFilters={activeFilters}
43
- />
44
- ) : (
45
- <DialogContentText id="alert-dialog-description">
46
- Are you sure to add All Files
47
- {' '}
48
- {numberOfFilesSelected}
49
- {' '}
50
- to cart
51
- </DialogContentText>
52
- )
53
- }
35
+ <DialogContentText id="alert-dialog-description">
36
+ Are you sure to add All Files
37
+ {' '}
38
+ {numberOfFilesSelected}
39
+ {' '}
40
+ to cart
41
+ </DialogContentText>
54
42
  </DialogContent>
55
- <DialogActions className="dialog_actions">
43
+ <DialogActions>
56
44
  <Button className="yesBtn" onClick={() => onYesClick()}>
57
45
  Yes
58
46
  </Button>
@@ -1,10 +1,9 @@
1
1
  import React, { useContext } from 'react';
2
- import { Button, Tooltip } from '@material-ui/core';
2
+ import { Button } from '@material-ui/core';
3
3
  import { useApolloClient } from '@apollo/client';
4
4
  import {
5
5
  downloadJson,
6
6
  CartContext,
7
- // eslint-disable-next-line import/no-unresolved
8
7
  } from '@bento-core/cart';
9
8
  import ToolTipView from './TooltipView';
10
9
 
@@ -13,15 +12,7 @@ const DownloadManifestView = (props) => {
13
12
  tooltipCofig,
14
13
  clsName,
15
14
  title,
16
- totalRowCount,
17
15
  } = props;
18
-
19
- const {
20
- icon,
21
- alt,
22
- arrow = false,
23
- clsName: toolTipClsName,
24
- } = tooltipCofig;
25
16
  /**
26
17
  * get cart state
27
18
  */
@@ -47,7 +38,7 @@ const DownloadManifestView = (props) => {
47
38
  ...getQueryVeriables(queryVariables),
48
39
  },
49
40
  })
50
- .then((result) => (table.objectKey ? result.data[table.objectKey] : result.data.filesInList));
41
+ .then((result) => result.data.filesInList);
51
42
  return fetchResult;
52
43
  }
53
44
 
@@ -63,26 +54,10 @@ const DownloadManifestView = (props) => {
63
54
  className={clsName}
64
55
  disableRipple
65
56
  onClick={() => DocumentDownload()}
66
- disabled={totalRowCount === 0}
67
57
  >
68
58
  {title}
69
59
  </Button>
70
- {(tooltipCofig && !tooltipCofig.customToolTipComponent) && (<ToolTipView {...props} />)}
71
- {(tooltipCofig && tooltipCofig.customToolTipComponent) && (
72
- <Tooltip
73
- arrow={arrow}
74
- interactive
75
- title={(
76
- <>
77
- {tooltipCofig.customToolTipComponent}
78
- </>
79
- )}
80
- placement="bottom"
81
- >
82
- {icon && (<img src={icon} alt={alt} className={toolTipClsName} />)}
83
- </Tooltip>
84
- )}
85
-
60
+ {tooltipCofig && (<ToolTipView {...props} />)}
86
61
  </>
87
62
  );
88
63
  };
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { connect } from 'react-redux';
3
- // eslint-disable-next-line import/no-unresolved
4
3
  import { onAddCartFiles } from '@bento-core/cart';
5
4
  import AddFiles from './AddFiles';
6
5
 
@@ -31,7 +31,7 @@ const SnackbarView = (props) => {
31
31
  <span className="snackBarText">
32
32
  {count}
33
33
  {' '}
34
- File(s) successfully added to My Files.
34
+ File(s) successfully added to your cart
35
35
  </span>
36
36
  </div>
37
37
  )}
@@ -2,7 +2,6 @@ import React, { useContext, useEffect, useState } from 'react';
2
2
  import {
3
3
  CartContext,
4
4
  onCommentChange,
5
- // eslint-disable-next-line import/no-unresolved
6
5
  } from '@bento-core/cart';
7
6
 
8
7
  const TextFieldView = ({
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- // eslint-disable-next-line import/no-unresolved
3
2
  import ToolTip from '@bento-core/tool-tip';
4
3
 
5
4
  /**
@@ -1,86 +0,0 @@
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
- ```
@@ -1,79 +0,0 @@
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
- ```
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- * max two response keys
9
- * add file query response handler
10
- * return - list of files name/id
11
- */
12
- const addFilesResponseHandler = function addFilesResponseHandler(response) {
13
- let responseKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
14
- if (responseKeys.length === 2) {
15
- const data = response[responseKeys[0]];
16
- if (data && data.length > 0) {
17
- const isArray = Array.isArray(data[0][responseKeys[1]]);
18
- const ids = data.reduce((acc, id) => {
19
- if (id && id[responseKeys[1]]) {
20
- // if object convert to array
21
- const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
22
- acc.push(...items);
23
- }
24
- return acc;
25
- }, []);
26
- return ids;
27
- }
28
- return [];
29
- }
30
- return response[responseKeys[0]] || [];
31
- };
32
- var _default = addFilesResponseHandler;
33
- exports.default = _default;
@@ -1,26 +0,0 @@
1
- /**
2
- * max two response keys
3
- * add file query response handler
4
- * return - list of files name/id
5
- */
6
- const addFilesResponseHandler = (response, responseKeys = []) => {
7
- if (responseKeys.length === 2) {
8
- const data = response[responseKeys[0]];
9
- if (data && data.length > 0) {
10
- const isArray = Array.isArray(data[0][responseKeys[1]]);
11
- const ids = data.reduce((acc, id) => {
12
- if (id && id[responseKeys[1]]) {
13
- // if object convert to array
14
- const items = isArray ? id[responseKeys[1]] : [id[responseKeys[1]]];
15
- acc.push(...items);
16
- }
17
- return acc;
18
- }, []);
19
- return ids;
20
- }
21
- return [];
22
- }
23
- return response[responseKeys[0]] || [];
24
- };
25
-
26
- export default addFilesResponseHandler;