imbric-theme 0.5.6 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,23 +9,47 @@ import Label from '../../atoms/Label'
|
|
9
9
|
import Icon from '../../atoms/Icon'
|
10
10
|
import Button from '../../atoms/Button'
|
11
11
|
import { Horizontal, Vertical } from '../../layout/Spacer/components'
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
import ReactTooltip from 'react-tooltip'
|
13
|
+
|
14
|
+
export const DynamicTable = ({
|
15
|
+
getStyles,
|
16
|
+
optionsData,
|
17
|
+
opColumns,
|
18
|
+
opAddColumns,
|
19
|
+
isLayoutDate,
|
20
|
+
isViewRange,
|
21
|
+
isViewAddColumn,
|
22
|
+
isViewBtn,
|
23
|
+
isViewDownloadDoc,
|
24
|
+
typeBtn,
|
25
|
+
titleBtn,
|
26
|
+
handleBtn,
|
27
|
+
handleAddColumn,
|
28
|
+
handleSelectRange,
|
29
|
+
handleDownloadExcel,
|
30
|
+
handleDefaultValue,
|
31
|
+
labelDinamicSelect,
|
32
|
+
placeholderDinamicSelect,
|
33
|
+
isLoadingDinamicSelect,
|
34
|
+
labelSinceDateRange,
|
35
|
+
labelTillDateRange,
|
36
|
+
txtTootipFileDownload,
|
37
|
+
}) => {
|
21
38
|
|
22
39
|
const [tableData, setTableData] = useState(optionsData);
|
23
40
|
const [columnsData, setColumnsData] = useState(opColumns);
|
24
41
|
const [addColumsData, setAddColumsData] = useState(opAddColumns);
|
25
42
|
|
26
|
-
//
|
27
|
-
|
28
|
-
|
43
|
+
// STATE TOOLTIP
|
44
|
+
const [isToolTipMounted, setIsToolTipMounted] = useState(false)
|
45
|
+
|
46
|
+
// TOOLTIP
|
47
|
+
const handleMouseEnter = () => {
|
48
|
+
setIsToolTipMounted(true)
|
49
|
+
}
|
50
|
+
const handleMouseLeave = () => {
|
51
|
+
setIsToolTipMounted(false)
|
52
|
+
}
|
29
53
|
|
30
54
|
useEffect(() => {
|
31
55
|
setColumnsData(opColumns);
|
@@ -47,44 +71,6 @@ export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns,
|
|
47
71
|
}
|
48
72
|
};
|
49
73
|
|
50
|
-
// const handleAddColumn = (event) => {
|
51
|
-
|
52
|
-
// let listKeyColumnOrder = []
|
53
|
-
|
54
|
-
// event.forEach(element => {
|
55
|
-
// listKeyColumnOrder[element.value] = true
|
56
|
-
// });
|
57
|
-
|
58
|
-
// for (const itemAddColumns of addColumsData) {
|
59
|
-
// if (listKeyColumnOrder[itemAddColumns.value]) {
|
60
|
-
// itemAddColumns.activeView = true
|
61
|
-
// } else {
|
62
|
-
// itemAddColumns.activeView = false
|
63
|
-
// }
|
64
|
-
// }
|
65
|
-
|
66
|
-
// for (const itemEvent of addColumsData) {
|
67
|
-
|
68
|
-
// for (const itemColumns of columnsData) {
|
69
|
-
|
70
|
-
// if (itemColumns.accessor === itemEvent.value) {
|
71
|
-
|
72
|
-
// if (itemEvent.activeView) {
|
73
|
-
// itemColumns.activeView = true
|
74
|
-
// } else {
|
75
|
-
// itemColumns.activeView = false
|
76
|
-
// }
|
77
|
-
|
78
|
-
|
79
|
-
// }
|
80
|
-
// }
|
81
|
-
|
82
|
-
// }
|
83
|
-
|
84
|
-
// setColumnsData([])
|
85
|
-
|
86
|
-
// }
|
87
|
-
|
88
74
|
return (
|
89
75
|
|
90
76
|
|
@@ -143,12 +129,30 @@ export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns,
|
|
143
129
|
|
144
130
|
{isViewDownloadDoc ? (
|
145
131
|
<div className={getStyles('opFunctionBox3')}>
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
132
|
+
|
133
|
+
|
134
|
+
<span
|
135
|
+
data-tip
|
136
|
+
data-for='fileDownload'
|
137
|
+
onMouseEnter={handleMouseEnter}
|
138
|
+
onMouseLeave={handleMouseLeave}
|
139
|
+
>
|
140
|
+
<Icon
|
141
|
+
key="fileDownload"
|
142
|
+
background="inverted"
|
143
|
+
name="fileDownload"
|
144
|
+
onClick={handleDownloadExcel}
|
145
|
+
/>
|
146
|
+
|
147
|
+
</span>
|
148
|
+
|
149
|
+
{isToolTipMounted ? (
|
150
|
+
<ReactTooltip id='fileDownload' type='error'>
|
151
|
+
<span>{txtTootipFileDownload}</span>
|
152
|
+
</ReactTooltip>
|
153
|
+
) : null}
|
154
|
+
|
155
|
+
|
152
156
|
</div>
|
153
157
|
) : null}
|
154
158
|
|
@@ -192,6 +196,7 @@ DynamicTable.propTypes = {
|
|
192
196
|
typeBtn: PropTypes.string,
|
193
197
|
titleBtn: PropTypes.string,
|
194
198
|
handleBtn: PropTypes.func,
|
199
|
+
txtTootipFileDownload: PropTypes.string,
|
195
200
|
}
|
196
201
|
|
197
202
|
DynamicTable.defaultProps = {
|
@@ -211,6 +216,7 @@ DynamicTable.defaultProps = {
|
|
211
216
|
typeBtn: 'primary',
|
212
217
|
titleBtn: '',
|
213
218
|
handleBtn: () => { },
|
219
|
+
txtTootipFileDownload: '',
|
214
220
|
}
|
215
221
|
|
216
222
|
export default withStyles(styles)(DynamicTable)
|