@eturnity/eturnity_reusable_components 7.24.3-EPDM-7509.2 → 7.24.3-EPDM-7509.3
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/package.json
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
:cellPaddings="cellPaddings"
|
20
20
|
:tableCursor="tableCursor"
|
21
21
|
@mouseover="setHovers($event)"
|
22
|
-
@mouseleave="
|
22
|
+
@mouseleave="removeHoverClass"
|
23
23
|
>
|
24
24
|
<slot />
|
25
25
|
</table-container>
|
@@ -123,8 +123,8 @@ const TableContainer = styled('table', containerAttrs)`
|
|
123
123
|
}
|
124
124
|
|
125
125
|
tbody {
|
126
|
-
tr
|
127
|
-
&:hover,
|
126
|
+
tr {
|
127
|
+
&:hover, td.hovered-column {
|
128
128
|
background-color: ${(props) => props.theme.colors.white};
|
129
129
|
cursor: ${(props) => (props.tableCursor ? props.tableCursor : 'auto')};
|
130
130
|
|
@@ -427,16 +427,20 @@ export default {
|
|
427
427
|
}
|
428
428
|
},
|
429
429
|
methods: {
|
430
|
+
removeHoverClass() {
|
431
|
+
const hoveredItems = document.querySelectorAll('.hovered-column')
|
432
|
+
hoveredItems.forEach((el) => {
|
433
|
+
el.classList.remove('hovered-column')
|
434
|
+
})
|
435
|
+
},
|
430
436
|
setHovers(event) {
|
437
|
+
this.removeHoverClass()
|
431
438
|
if (event.target.tagName !== 'TABLE') {
|
432
|
-
console.log('over', event)
|
433
439
|
let hoveredCell = event.target
|
434
|
-
console.log(hoveredCell.tagName)
|
435
440
|
|
436
441
|
if (hoveredCell.tagName !== 'TD') {
|
437
442
|
let currentParentElement = hoveredCell.parentElement
|
438
443
|
while (currentParentElement.tagName !== 'TR') {
|
439
|
-
console.log(currentParentElement.tagName)
|
440
444
|
if (currentParentElement.tagName === 'TD') hoveredCell = currentParentElement
|
441
445
|
currentParentElement = currentParentElement.parentElement
|
442
446
|
}
|
@@ -447,7 +451,9 @@ export default {
|
|
447
451
|
const rowList = Array.from(document.querySelectorAll('tr'))
|
448
452
|
rowList.forEach((el) => {
|
449
453
|
const cells = Array.from(el.children)
|
450
|
-
cells[rowChildren.indexOf(hoveredCell)]
|
454
|
+
if (cells[rowChildren.indexOf(hoveredCell)]) {
|
455
|
+
cells[rowChildren.indexOf(hoveredCell)].classList.add('hovered-column')
|
456
|
+
}
|
451
457
|
})
|
452
458
|
}
|
453
459
|
}
|