@eturnity/eturnity_reusable_components 7.24.3-EPDM-10926.0 → 7.24.3-EPDM-7509.4

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-10926.0",
3
+ "version": "7.24.3-EPDM-7509.4",
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,6 +0,0 @@
1
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M20 13L27 16.8175L26.0477 18.4379L20 15.1397L13.9523 18.4379L13 16.8175L20 13Z" fill="#263238"/>
3
- <path d="M17.1006 19.1906L20.0001 17.6078L22.8996 19.1906" stroke="#263238" stroke-width="2"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M20 21.5621L22.6508 23.0078L21.6985 24.6282L20 23.7019L18.3015 24.6282L17.3492 23.0078L20 21.5621ZM16.1269 25.8141L13.9523 27L13 25.3797L15.1746 24.1937L16.1269 25.8141ZM26.0477 27L23.8731 25.8141L24.8254 24.1937L27 25.3797L26.0477 27Z" fill="#263238"/>
5
- <path d="M20.9662 22.9146H19.0332L19.0332 18.2928H20.9662L20.9662 22.9146Z" fill="#263238"/>
6
- </svg>