@bento-core/table 1.0.1-ccdiintegrated.5 → 1.0.1-ccdiintegrated.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.
- package/dist/wrapper/components/AddFiles.js +2 -0
- package/dist/wrapper/components/AddToCart/AddToCartView.js +5 -3
- package/dist/wrapper/components/AddToCart/ReduxAddToCart.js +1 -0
- package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +1 -1
- package/dist/wrapper/components/ReduxAddFile.js +1 -0
- package/dist/wrapper/components/Snackbar/Snackbar.js +3 -1
- package/package.json +2 -2
- package/src/wrapper/components/AddFiles.js +2 -0
- package/src/wrapper/components/AddToCart/AddToCartView.js +4 -2
- package/src/wrapper/components/AddToCart/ReduxAddToCart.js +1 -0
- package/src/wrapper/components/CPIFilesView/CPIFilesView.js +1 -1
- package/src/wrapper/components/ReduxAddFile.js +1 -0
- package/src/wrapper/components/Snackbar/Snackbar.js +3 -3
|
@@ -26,6 +26,7 @@ exports.btnTypes = btnTypes;
|
|
|
26
26
|
const AddFilesView = props => {
|
|
27
27
|
const {
|
|
28
28
|
count,
|
|
29
|
+
alreadyInCartCount,
|
|
29
30
|
alertMessage,
|
|
30
31
|
cartFiles,
|
|
31
32
|
buttonStyle
|
|
@@ -52,6 +53,7 @@ const AddFilesView = props => {
|
|
|
52
53
|
})), /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
53
54
|
open: openSnackbar,
|
|
54
55
|
count: count,
|
|
56
|
+
alreadyInCartCount: alreadyInCartCount,
|
|
55
57
|
onClose: () => setOpenSnackbar(false)
|
|
56
58
|
}), displayAlter && /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
|
|
57
59
|
alertMessage: alertMessage,
|
|
@@ -69,7 +69,8 @@ const AddToCartView = props => {
|
|
|
69
69
|
fileId,
|
|
70
70
|
buttonStyle,
|
|
71
71
|
addFiles,
|
|
72
|
-
count
|
|
72
|
+
count,
|
|
73
|
+
alreadyInCartCount
|
|
73
74
|
} = props;
|
|
74
75
|
|
|
75
76
|
// const [isDataloading, setIsDataloading] = useState(false);
|
|
@@ -90,14 +91,14 @@ const AddToCartView = props => {
|
|
|
90
91
|
*/
|
|
91
92
|
const addAllFiles = () => {
|
|
92
93
|
const idsInitial = fileId || [];
|
|
93
|
-
const ids = [idsInitial];
|
|
94
|
+
const ids = Array.isArray(idsInitial) ? idsInitial : [idsInitial];
|
|
94
95
|
const fileCount = ids.length;
|
|
95
96
|
const upperLimit = 200000;
|
|
96
97
|
const cartCount = cartFiles.length;
|
|
97
98
|
if (fileCount <= upperLimit && cartCount < upperLimit) {
|
|
98
99
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
99
100
|
if (cartCount + newIds.length <= upperLimit) {
|
|
100
|
-
addFiles(
|
|
101
|
+
addFiles(ids);
|
|
101
102
|
setOpenSnackbar(true);
|
|
102
103
|
} else {
|
|
103
104
|
setAlterDisplay(true);
|
|
@@ -115,6 +116,7 @@ const AddToCartView = props => {
|
|
|
115
116
|
}, "ADD TO CART"), /*#__PURE__*/_react.default.createElement(_Snackbar.default, {
|
|
116
117
|
open: openSnackbar,
|
|
117
118
|
count: count,
|
|
119
|
+
alreadyInCartCount: alreadyInCartCount,
|
|
118
120
|
onClose: () => setOpenSnackbar(false)
|
|
119
121
|
}), displayAlter && /*#__PURE__*/_react.default.createElement(_AddToCartDialogAlertView.default, {
|
|
120
122
|
alertMessage: "The cart is limited to 200,000 files. Please narrow the search criteria or remove some files from the cart to add more.",
|
|
@@ -16,6 +16,7 @@ const AddToCartRedux = props => /*#__PURE__*/_react.default.createElement(_AddTo
|
|
|
16
16
|
*/
|
|
17
17
|
const mapStateToProps = state => ({
|
|
18
18
|
count: state.cartReducer && state.cartReducer.count,
|
|
19
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
19
20
|
cartFiles: state.cartReducer && state.cartReducer.filesId
|
|
20
21
|
});
|
|
21
22
|
const mapDispatchToProps = dispatch => ({
|
|
@@ -139,7 +139,7 @@ const CPIFilesComponent = props => {
|
|
|
139
139
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
140
140
|
if (cartCount + newIds.length <= upperLimit) {
|
|
141
141
|
setOpen(true);
|
|
142
|
-
setAddFilesId(
|
|
142
|
+
setAddFilesId(ids);
|
|
143
143
|
} else {
|
|
144
144
|
setAlterDisplay(true);
|
|
145
145
|
}
|
|
@@ -16,6 +16,7 @@ const AddFilesRedux = props => /*#__PURE__*/_react.default.createElement(_AddFil
|
|
|
16
16
|
*/
|
|
17
17
|
const mapStateToProps = state => ({
|
|
18
18
|
count: state.cartReducer && state.cartReducer.count,
|
|
19
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
19
20
|
cartFiles: state.cartReducer && state.cartReducer.filesId
|
|
20
21
|
});
|
|
21
22
|
const mapDispatchToProps = dispatch => ({
|
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _core = require("@material-ui/core");
|
|
9
|
+
var _cart = require("@bento-core/cart");
|
|
9
10
|
var _SuccessOutlined = _interopRequireDefault(require("./SuccessOutlined"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
const SnackbarView = props => {
|
|
12
13
|
const {
|
|
13
14
|
count,
|
|
15
|
+
alreadyInCartCount = 0,
|
|
14
16
|
open,
|
|
15
17
|
onClose
|
|
16
18
|
} = props;
|
|
@@ -38,7 +40,7 @@ const SnackbarView = props => {
|
|
|
38
40
|
className: "snackBarMessageIcon"
|
|
39
41
|
}, /*#__PURE__*/_react.default.createElement(_SuccessOutlined.default, null), ' '), /*#__PURE__*/_react.default.createElement("span", {
|
|
40
42
|
className: "snackBarText"
|
|
41
|
-
},
|
|
43
|
+
}, (0, _cart.formatCartAddMessage)(count, alreadyInCartCount)))
|
|
42
44
|
}));
|
|
43
45
|
};
|
|
44
46
|
var _default = SnackbarView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/table",
|
|
3
|
-
"version": "1.0.1-ccdiintegrated.
|
|
3
|
+
"version": "1.0.1-ccdiintegrated.6",
|
|
4
4
|
"homepage": "https://github.com/CBIIT/bento-frontend#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/CBIIT/bento-frontend/issues"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@apollo/client": "^3.8.3",
|
|
23
|
-
"@bento-core/cart": "1.0.1-ccdiintegrated.
|
|
23
|
+
"@bento-core/cart": "1.0.1-ccdiintegrated.2",
|
|
24
24
|
"@bento-core/tool-tip": "1.0.1-ccdiintegrated.1",
|
|
25
25
|
"@bento-core/util": "1.0.1-ccdiintegrated.1",
|
|
26
26
|
"clsx": "^2.1.1",
|
|
@@ -16,6 +16,7 @@ export const btnTypes = {
|
|
|
16
16
|
const AddFilesView = (props) => {
|
|
17
17
|
const {
|
|
18
18
|
count,
|
|
19
|
+
alreadyInCartCount,
|
|
19
20
|
alertMessage,
|
|
20
21
|
cartFiles,
|
|
21
22
|
buttonStyle,
|
|
@@ -46,6 +47,7 @@ const AddFilesView = (props) => {
|
|
|
46
47
|
<SnackbarView
|
|
47
48
|
open={openSnackbar}
|
|
48
49
|
count={count}
|
|
50
|
+
alreadyInCartCount={alreadyInCartCount}
|
|
49
51
|
onClose={() => setOpenSnackbar(false)}
|
|
50
52
|
/>
|
|
51
53
|
{(displayAlter) && (
|
|
@@ -66,6 +66,7 @@ const AddToCartView = (props) => {
|
|
|
66
66
|
buttonStyle,
|
|
67
67
|
addFiles,
|
|
68
68
|
count,
|
|
69
|
+
alreadyInCartCount,
|
|
69
70
|
} = props;
|
|
70
71
|
|
|
71
72
|
// const [isDataloading, setIsDataloading] = useState(false);
|
|
@@ -85,14 +86,14 @@ const AddToCartView = (props) => {
|
|
|
85
86
|
*/
|
|
86
87
|
const addAllFiles = () => {
|
|
87
88
|
const idsInitial = fileId || [];
|
|
88
|
-
const ids = [idsInitial];
|
|
89
|
+
const ids = Array.isArray(idsInitial) ? idsInitial : [idsInitial];
|
|
89
90
|
const fileCount = ids.length;
|
|
90
91
|
const upperLimit = 200000;
|
|
91
92
|
const cartCount = cartFiles.length;
|
|
92
93
|
if (fileCount <= upperLimit && cartCount < upperLimit) {
|
|
93
94
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
94
95
|
if (cartCount + newIds.length <= upperLimit) {
|
|
95
|
-
addFiles(
|
|
96
|
+
addFiles(ids);
|
|
96
97
|
setOpenSnackbar(true);
|
|
97
98
|
} else {
|
|
98
99
|
setAlterDisplay(true);
|
|
@@ -116,6 +117,7 @@ const AddToCartView = (props) => {
|
|
|
116
117
|
<SnackbarView
|
|
117
118
|
open={openSnackbar}
|
|
118
119
|
count={count}
|
|
120
|
+
alreadyInCartCount={alreadyInCartCount}
|
|
119
121
|
onClose={() => setOpenSnackbar(false)}
|
|
120
122
|
/>
|
|
121
123
|
{displayAlter && (
|
|
@@ -10,6 +10,7 @@ const AddToCartRedux = (props) => <AddToCartView {...props} />;
|
|
|
10
10
|
*/
|
|
11
11
|
const mapStateToProps = (state) => ({
|
|
12
12
|
count: state.cartReducer && state.cartReducer.count,
|
|
13
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
13
14
|
cartFiles: state.cartReducer && state.cartReducer.filesId,
|
|
14
15
|
});
|
|
15
16
|
|
|
@@ -139,7 +139,7 @@ const CPIFilesComponent = (props) => {
|
|
|
139
139
|
const newIds = checkDuplicate(cartFiles, ids);
|
|
140
140
|
if (cartCount + newIds.length <= upperLimit) {
|
|
141
141
|
setOpen(true);
|
|
142
|
-
setAddFilesId(
|
|
142
|
+
setAddFilesId(ids);
|
|
143
143
|
} else {
|
|
144
144
|
setAlterDisplay(true);
|
|
145
145
|
}
|
|
@@ -10,6 +10,7 @@ const AddFilesRedux = (props) => <AddFiles {...props} />;
|
|
|
10
10
|
*/
|
|
11
11
|
const mapStateToProps = (state) => ({
|
|
12
12
|
count: state.cartReducer && state.cartReducer.count,
|
|
13
|
+
alreadyInCartCount: state.cartReducer && state.cartReducer.alreadyInCartCount,
|
|
13
14
|
cartFiles: state.cartReducer && state.cartReducer.filesId,
|
|
14
15
|
});
|
|
15
16
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Snackbar } from '@material-ui/core';
|
|
3
|
+
import { formatCartAddMessage } from '@bento-core/cart';
|
|
3
4
|
import SuccessOutlinedIcon from './SuccessOutlined';
|
|
4
5
|
|
|
5
6
|
const SnackbarView = (props) => {
|
|
6
7
|
const {
|
|
7
8
|
count,
|
|
9
|
+
alreadyInCartCount = 0,
|
|
8
10
|
open,
|
|
9
11
|
onClose,
|
|
10
12
|
} = props;
|
|
@@ -30,9 +32,7 @@ const SnackbarView = (props) => {
|
|
|
30
32
|
{' '}
|
|
31
33
|
</span>
|
|
32
34
|
<span className="snackBarText">
|
|
33
|
-
{count}
|
|
34
|
-
{' '}
|
|
35
|
-
File(s) successfully added to your cart
|
|
35
|
+
{formatCartAddMessage(count, alreadyInCartCount)}
|
|
36
36
|
</span>
|
|
37
37
|
</div>
|
|
38
38
|
)}
|