@eturnity/eturnity_reusable_components 7.24.3-EPDM-11143.1 → 7.30.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.24.3-EPDM-11143.1",
3
+ "version": "7.30.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -18,6 +18,8 @@
18
18
  v-else
19
19
  :cellPaddings="cellPaddings"
20
20
  :tableCursor="tableCursor"
21
+ @mouseover="hasAimHover ? setHovers($event) : null"
22
+ @mouseleave="hasAimHover ? removeHoverClass : null"
21
23
  >
22
24
  <slot />
23
25
  </table-container>
@@ -122,7 +124,7 @@ const TableContainer = styled('table', containerAttrs)`
122
124
 
123
125
  tbody {
124
126
  tr {
125
- &:hover {
127
+ &:hover, td.hovered-column {
126
128
  background-color: ${(props) => props.theme.colors.white};
127
129
  cursor: ${(props) => (props.tableCursor ? props.tableCursor : 'auto')};
128
130
 
@@ -406,6 +408,10 @@ export default {
406
408
  required: false,
407
409
  default: null
408
410
  },
411
+ hasAimHover: {
412
+ required: false,
413
+ default: false
414
+ },
409
415
  tableCursor: {
410
416
  required: false
411
417
  }
@@ -425,6 +431,46 @@ export default {
425
431
  }
426
432
  },
427
433
  methods: {
434
+ findParentElementByTagName(element, tagName) {
435
+ let currentParentElement = element.parentElement
436
+ while (currentParentElement && currentParentElement.tagName !== tagName) {
437
+ currentParentElement = currentParentElement.parentElement
438
+ }
439
+
440
+ return currentParentElement && currentParentElement.tagName === tagName ? currentParentElement : null
441
+ },
442
+ removeHoverClass() {
443
+ const hoveredItems = document.querySelectorAll('.hovered-column')
444
+ hoveredItems.forEach((el) => {
445
+ el.classList.remove('hovered-column')
446
+ })
447
+ },
448
+ setHovers(event) {
449
+ this.removeHoverClass()
450
+ if (event.target.tagName !== 'TABLE' && event.target.tagName !== 'TH' && event.target.tagName !== 'TR') {
451
+ let hoveredCell = event.target
452
+
453
+ if (hoveredCell.tagName !== 'TD') {
454
+ // Looking for hovered TD element
455
+ hoveredCell = this.findParentElementByTagName(hoveredCell, 'TD')
456
+ }
457
+
458
+ if (hoveredCell) {
459
+ const rowChildren = Array.from(hoveredCell.parentElement.children)
460
+ const hoveredCellIndex = rowChildren.indexOf(hoveredCell)
461
+ const currentTable = this.findParentElementByTagName(hoveredCell, 'TABLE')
462
+ if (currentTable) {
463
+ const rowList = Array.from(currentTable.querySelectorAll('tr'))
464
+ rowList.forEach((el) => {
465
+ const cells = Array.from(el.children)
466
+ if (cells[hoveredCellIndex]) {
467
+ cells[hoveredCellIndex].classList.add('hovered-column')
468
+ }
469
+ })
470
+ }
471
+ }
472
+ }
473
+ },
428
474
  observeTableHeight() {
429
475
  if (!this.$refs.tableRef) return
430
476
 
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
- <svg width="800px" height="800px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
4
- <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
- <g id="copy" fill="none" transform="translate(85.333333, 42.666667)">
6
- <path d="M341.333333,85.3333333 L341.333333,405.333333 L85.3333333,405.333333 L85.3333333,85.3333333 L341.333333,85.3333333 Z M298.666667,128 L128,128 L128,362.666667 L298.666667,362.666667 L298.666667,128 Z M234.666667,7.10542736e-15 L234.666667,42.6666667 L42.6666667,42.6666667 L42.6666667,298.666667 L1.42108547e-14,298.666667 L1.42108547e-14,7.10542736e-15 L234.666667,7.10542736e-15 Z">
7
- </path>
8
- </g>
9
- </g>
10
- </svg>