@bento-core/table 1.0.1-ccdihub.89 → 1.0.1-ccdihub.90

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 (47) hide show
  1. package/dist/ExtendedView.js +2 -8
  2. package/dist/TableView.js +5 -9
  3. package/dist/body/CustomTblBody.js +2 -4
  4. package/dist/body/DisplayBodyCell.js +4 -8
  5. package/dist/body/components/CPIModal.js +15 -156
  6. package/dist/body/components/CPIView.js +4 -6
  7. package/dist/body/components/CustomLinkView.js +1 -1
  8. package/dist/header/CustomTblHeader.js +3 -5
  9. package/dist/pagination/CustomPagination.js +2 -7
  10. package/package.json +2 -8
  11. package/src/ExtendedView.js +6 -15
  12. package/src/TableView.js +5 -11
  13. package/src/body/CustomTblBody.js +0 -2
  14. package/src/body/DisplayBodyCell.js +0 -4
  15. package/src/body/components/CPIModal.js +12 -165
  16. package/src/body/components/CPIView.js +2 -10
  17. package/src/body/components/CustomLinkView.js +1 -1
  18. package/src/header/CustomTblHeader.js +1 -6
  19. package/src/pagination/CustomPagination.js +0 -2
  20. package/dist/body/components/assets/Cart_Icon.svg +0 -3
  21. package/dist/body/components/assets/Question_Icon.svg +0 -4
  22. package/dist/wrapper/WrapperService.js +0 -36
  23. package/dist/wrapper/components/AddFiles.js +0 -63
  24. package/dist/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +0 -35
  25. package/dist/wrapper/components/AddToCartDialog/AddToCartDialogController.js +0 -36
  26. package/dist/wrapper/components/AddToCartDialog/AddToCartDialogView.js +0 -43
  27. package/dist/wrapper/components/CPIFilesView/CPIFilesView.js +0 -178
  28. package/dist/wrapper/components/ReduxAddFile.js +0 -27
  29. package/dist/wrapper/components/Snackbar/Snackbar.js +0 -40
  30. package/dist/wrapper/components/Snackbar/SnackbarRedux.js +0 -16
  31. package/dist/wrapper/components/Snackbar/SuccessOutlined.js +0 -17
  32. package/dist/wrapper/components/TextFieldView.js +0 -37
  33. package/dist/wrapper/components/TooltipView.js +0 -40
  34. package/src/body/components/assets/Cart_Icon.svg +0 -3
  35. package/src/body/components/assets/Question_Icon.svg +0 -4
  36. package/src/wrapper/WrapperService.js +0 -25
  37. package/src/wrapper/components/AddFiles.js +0 -62
  38. package/src/wrapper/components/AddToCartDialog/AddToCartDialogAlertView.js +0 -37
  39. package/src/wrapper/components/AddToCartDialog/AddToCartDialogController.js +0 -32
  40. package/src/wrapper/components/AddToCartDialog/AddToCartDialogView.js +0 -57
  41. package/src/wrapper/components/CPIFilesView/CPIFilesView.js +0 -190
  42. package/src/wrapper/components/ReduxAddFile.js +0 -20
  43. package/src/wrapper/components/Snackbar/Snackbar.js +0 -43
  44. package/src/wrapper/components/Snackbar/SnackbarRedux.js +0 -11
  45. package/src/wrapper/components/Snackbar/SuccessOutlined.js +0 -10
  46. package/src/wrapper/components/TextFieldView.js +0 -32
  47. package/src/wrapper/components/TooltipView.js +0 -35
@@ -1,190 +0,0 @@
1
- import React, { useState } from 'react';
2
- import ToolTip from '@bento-core/tool-tip';
3
- import { Button } from '@material-ui/core';
4
- import clsx from 'clsx';
5
- import gql from 'graphql-tag';
6
- import { getFilesID } from '../../WrapperService';
7
- import AddToCartDialogView from '../AddToCartDialog/AddToCartDialogView';
8
-
9
- const customTooltip = {
10
- border: '#03A383 1px solid',
11
- };
12
-
13
- const customArrow = {
14
- '&::before': {
15
- border: '#03A383 1px solid',
16
- },
17
- };
18
-
19
- const iconStyle = {
20
- paddingRight: '20px',
21
- paddingBottom: '20px',
22
- paddingLeft: '5px',
23
- };
24
-
25
- export const ToolTipView = (props) => {
26
- const {
27
- section,
28
- tooltipCofig,
29
- } = props;
30
- const {
31
- icon,
32
- src,
33
- alt,
34
- arrow = false,
35
- tooltipText,
36
- } = tooltipCofig;
37
- return (
38
- <ToolTip
39
- placement="top"
40
- title={tooltipText || `${tooltipCofig[section]}`}
41
- arrow={arrow}
42
- classes={{
43
- tooltip: customTooltip,
44
- arrow: customArrow,
45
- }}
46
- >
47
- <img src={icon || src} alt={alt} style={iconStyle} />
48
- </ToolTip>
49
- );
50
- };
51
-
52
- // const checkDuplicate = (cartFiles, ids) => {
53
- // const newIds = [];
54
- // for (let i = 0; i < ids.length; i += 1) {
55
- // if (!cartFiles.includes(ids[i])) {
56
- // newIds.push(ids[i]);
57
- // }
58
- // }
59
- // return newIds;
60
- // };
61
-
62
- const checkDuplicate = (cartFiles, ids) => (ids.filter((id) => !cartFiles[id]));
63
-
64
- const addFileQuery = gql`
65
- query search (
66
- $participant_ids: [String],
67
- ){
68
- fileIDsFromList (
69
- participant_ids: $participant_ids,
70
- )
71
- }
72
- `;
73
-
74
- const CPIFilesComponent = (props) => {
75
- const {
76
- title,
77
- btnType,
78
- clsName,
79
- section,
80
- addFiles,
81
- setAlterDisplay,
82
- setOpenSnackbar,
83
- client,
84
- tooltipCofig,
85
- cartFiles,
86
- participantIds,
87
- buttonStyle,
88
- rowID,
89
- } = props;
90
- /**
91
- * conditionally display dialog view
92
- */
93
- const [openAddDialog, setOpen] = useState(false);
94
- const toggleOpen = () => setOpen(!openAddDialog);
95
- const [addFilesId, setAddFilesId] = useState([]);
96
- // const [isDataloading, setIsDataloading] = useState(false);
97
- const responseKeys = ['fileIDsFromList'];
98
-
99
- const cartFilesDict = {};
100
- cartFiles.forEach((file) => { cartFilesDict[file] = true; });
101
-
102
- // const backdropCls = {
103
- // width: '100%',
104
- // zIndex: 99999,
105
- // background: 'rgba(0, 0, 0, 0.1)',
106
- // };
107
- /**
108
- * verify and set file ids
109
- */
110
- const addAllFiles = () => {
111
- let toAdd = [];
112
- if (btnType === 'ADD_ALL_FILES') {
113
- participantIds.forEach((e) => {
114
- if (e.data_type === 'internal' && e.p_id) {
115
- toAdd = toAdd.concat(e.p_id);
116
- }
117
- toAdd = toAdd.concat(rowID);
118
- });
119
- } else {
120
- toAdd = participantIds.concat(rowID);
121
- }
122
- const fileIds = getFilesID({
123
- client,
124
- variables: { participant_ids: toAdd },
125
- query: addFileQuery,
126
- });
127
- const upperLimit = 200000;
128
- const cartCount = cartFiles.length;
129
- if (cartCount < upperLimit) {
130
- fileIds().then((response) => {
131
- const idsInitial = response[responseKeys[0]] || [];
132
- const ids = [...new Set(idsInitial)];
133
- const fileCount = ids.length;
134
- if (fileCount <= upperLimit && cartCount < upperLimit) {
135
- if (cartCount + ids.length <= upperLimit) {
136
- setOpen(true);
137
- setAddFilesId(ids);
138
- } else {
139
- const newIds = checkDuplicate(cartFiles, ids);
140
- if (cartCount + newIds.length <= upperLimit) {
141
- setOpen(true);
142
- setAddFilesId(newIds);
143
- } else {
144
- setAlterDisplay(true);
145
- }
146
- }
147
- } else {
148
- setAlterDisplay(true);
149
- }
150
- });
151
- } else {
152
- setAlterDisplay(true);
153
- }
154
- };
155
-
156
- /**
157
- * use wrapper service to add files to cart
158
- */
159
- const addFilesToCart = () => {
160
- addFiles(addFilesId);
161
- toggleOpen();
162
- setOpenSnackbar(true);
163
- };
164
-
165
- return (
166
- <>
167
- <Button
168
- onClick={addAllFiles}
169
- className={clsx(clsName, `${clsName}_${section}`)}
170
- disableRipple
171
- style={buttonStyle}
172
- disabled={btnType === 'ADD_SELECTED_FILES' && participantIds.length === 0}
173
- >
174
- {title}
175
- </Button>
176
- {tooltipCofig && (<ToolTipView {...props} />)}
177
- <AddToCartDialogView
178
- open={openAddDialog}
179
- onYesClick={addFilesToCart}
180
- onNoClick={toggleOpen}
181
- dialogText={btnType === 'ADD_SELECTED_FILES' ? 'Are you sure to add selected files' : 'Are you sure to add All Files'}
182
- />
183
- {/* <Backdrop className={backdropCls} style={backdropCls} open={isDataloading}>
184
- <CircularProgress color="inherit" />
185
- </Backdrop> */}
186
- </>
187
- );
188
- };
189
-
190
- export default CPIFilesComponent;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { connect } from 'react-redux';
3
- import { onAddCartFiles } from '@bento-core/cart';
4
- import AddFiles from './AddFiles';
5
-
6
- const AddFilesRedux = (props) => <AddFiles {...props} />;
7
-
8
- /**
9
- * create query variable with actie filters
10
- */
11
- const mapStateToProps = (state) => ({
12
- count: state.cartReducer && state.cartReducer.count,
13
- cartFiles: state.cartReducer && state.cartReducer.filesId,
14
- });
15
-
16
- const mapDispatchToProps = (dispatch) => ({
17
- addFiles: (files) => { dispatch(onAddCartFiles(files)); },
18
- });
19
-
20
- export default connect(mapStateToProps, mapDispatchToProps)(AddFilesRedux);
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- import { Snackbar } from '@material-ui/core';
3
- import SuccessOutlinedIcon from './SuccessOutlined';
4
-
5
- const SnackbarView = (props) => {
6
- const {
7
- count,
8
- open,
9
- onClose,
10
- } = props;
11
-
12
- if (open) {
13
- setTimeout(() => {
14
- onClose();
15
- }, 3000);
16
- }
17
-
18
- return (
19
- <>
20
- <Snackbar
21
- className="snackBar"
22
- open={open}
23
- autoHideDuration={3000}
24
- anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
25
- message={(
26
- <div className="snackBarMessage">
27
- <span className="snackBarMessageIcon">
28
- <SuccessOutlinedIcon />
29
- {' '}
30
- </span>
31
- <span className="snackBarText">
32
- {count}
33
- {' '}
34
- File(s) successfully added to your cart
35
- </span>
36
- </div>
37
- )}
38
- />
39
- </>
40
- );
41
- };
42
-
43
- export default SnackbarView;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { connect } from 'react-redux';
3
- import SnackbarView from './Snackbar';
4
-
5
- const ReduxSnackbar = ((props) => <SnackbarView {...props} />);
6
-
7
- const mapStateToProps = (state) => ({
8
- count: state.cartReducer.count,
9
- });
10
-
11
- export default connect(mapStateToProps, null)(ReduxSnackbar);
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { createSvgIcon } from '@bento-core/util';
3
-
4
- /**
5
- * @ignore - internal component.
6
- */
7
- export default createSvgIcon(
8
- <path d="M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z" />,
9
- 'SuccessOutlined',
10
- );
@@ -1,32 +0,0 @@
1
- import React, { useContext, useEffect, useState } from 'react';
2
- import {
3
- CartContext,
4
- onCommentChange,
5
- } from '@bento-core/cart';
6
-
7
- const TextFieldView = ({
8
- clsName,
9
- placeholder,
10
- }) => {
11
- const [text, setText] = useState('');
12
- const cartContext = useContext(CartContext);
13
- const { context } = cartContext;
14
- const {
15
- dispatch,
16
- } = context;
17
- useEffect(() => {
18
- dispatch(onCommentChange(text));
19
- }, [text]);
20
- return (
21
- <textarea
22
- onChange={(e) => {
23
- setText(`${e.target.value}`);
24
- }}
25
- className={clsName}
26
- placeholder={placeholder}
27
- id="multiline-user-coments"
28
- />
29
- );
30
- };
31
-
32
- export default TextFieldView;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import ToolTip from '@bento-core/tool-tip';
3
-
4
- /**
5
- * customize tooltips based on tooltipContent
6
- * defined on dashboardTabData (tooltipContent)
7
- */
8
- const ToolTipView = (props) => {
9
- const {
10
- section,
11
- tooltipCofig,
12
- classes,
13
- } = props;
14
-
15
- const {
16
- icon,
17
- alt,
18
- arrow = false,
19
- clsName,
20
- } = tooltipCofig;
21
- return (
22
- <ToolTip
23
- title={tooltipCofig[section]}
24
- arrow={arrow}
25
- classes={{
26
- tooltip: classes.customTooltip,
27
- arrow: classes.customArrow,
28
- }}
29
- >
30
- {icon && (<img src={icon} alt={alt} className={clsName} />)}
31
- </ToolTip>
32
- );
33
- };
34
-
35
- export default ToolTipView;