vue2-excel-grid 2.8.0 → 2.8.2

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": "vue2-excel-grid",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Excel-style grid component for Vue 2.6.14 with virtual scrolling",
5
5
  "license": "MIT",
6
6
  "author": "Fozilbek Raimberdiyev",
@@ -144,6 +144,8 @@
144
144
  tabindex="0"
145
145
  @keydown="onKeyDown"
146
146
  @keypress="onKeyPress"
147
+ @mousemove="onGridMouseMove"
148
+ @mouseleave="onGridMouseLeave"
147
149
  ref="wrapper"
148
150
  >
149
151
  <!-- Context menu -->
@@ -508,6 +510,7 @@
508
510
  :key="'srh-' + ri"
509
511
  class="eg-row-header-cell"
510
512
  :style="getRowHeaderStyle(ri)"
513
+ :data-row="ri"
511
514
  @mousedown="onRowHeaderMouseDown($event, ri)"
512
515
  @contextmenu.prevent="onRowContextMenu($event, ri)"
513
516
  >
@@ -548,7 +551,7 @@
548
551
  <div :style="{ height: totalVirtualHeight + 'px', position: 'relative' }">
549
552
  <div :style="{ transform: 'translateY(' + virtualOffsetTop + 'px)', willChange: 'transform', contain: 'layout style' }">
550
553
  <template v-for="ri in visibleRowRange">
551
- <div v-if="!isRowHidden(ri)" :key="'fc-row-' + ri" class="eg-row" :class="{ 'eg-row--even': ri % 2 === 0 }" :style="getRowStyle(ri)">
554
+ <div v-if="!isRowHidden(ri)" :key="'fc-row-' + ri" class="eg-row" :class="{ 'eg-row--even': ri % 2 === 0 }" :style="getRowStyle(ri)" :data-row="ri">
552
555
  <template v-for="(col, ci) in leafCols">
553
556
  <template v-if="isColumnPinnedLeft(ci) && !isColHidden(ci)">
554
557
  <div
@@ -667,7 +670,7 @@
667
670
  <div :style="{ height: totalVirtualHeight + 'px', position: 'relative' }">
668
671
  <div :style="{ transform: 'translateY(' + virtualOffsetTop + 'px)', willChange: 'transform', contain: 'layout style' }">
669
672
  <template v-for="ri in visibleRowRange">
670
- <div v-if="!isRowHidden(ri)" :key="'pr-row-' + ri" class="eg-row" :class="{ 'eg-row--even': ri % 2 === 0 }" :style="getRowStyle(ri)">
673
+ <div v-if="!isRowHidden(ri)" :key="'pr-row-' + ri" class="eg-row" :class="{ 'eg-row--even': ri % 2 === 0 }" :style="getRowStyle(ri)" :data-row="ri">
671
674
  <template v-for="col in pinnedRightCols">
672
675
  <div
673
676
  :key="'pr-cell-' + ri + '-' + col._flatIndex"
@@ -2622,6 +2625,7 @@ const ExcelGridComponent = {
2622
2625
  // iterating all 50,000 rows each time. With 1200 cells per render that's
2623
2626
  // 60 million iterations per render (~600ms). _dataRaw bypasses this.
2624
2627
  this._dataRaw = this.data || []
2628
+ this._hoveredRi = -1
2625
2629
 
2626
2630
  // Non-reactive caches: same (w,h) → same style object → Vue 2 skips DOM style writes
2627
2631
  this._cellStyleCache = Object.create(null)
@@ -3824,6 +3828,45 @@ const ExcelGridComponent = {
3824
3828
  this.hideSortMenu()
3825
3829
  },
3826
3830
 
3831
+
3832
+ // =========================================================
3833
+ // HOVER HIGHLIGHT
3834
+ // =========================================================
3835
+ onGridMouseMove(e) {
3836
+ const rowNode = e.target.closest('[data-row]')
3837
+ const newRi = rowNode ? parseInt(rowNode.getAttribute('data-row'), 10) : -1
3838
+
3839
+ if (this._hoveredRi !== newRi) {
3840
+ if (this._hoveredRi >= 0) {
3841
+ const oldEls = this.$refs.wrapper.querySelectorAll(`[data-row="${this._hoveredRi}"]`)
3842
+ for (let i = 0; i < oldEls.length; i++) {
3843
+ oldEls[i].classList.remove('eg-row--hover')
3844
+ }
3845
+ }
3846
+
3847
+ this._hoveredRi = newRi
3848
+
3849
+ if (this._hoveredRi >= 0) {
3850
+ const newEls = this.$refs.wrapper.querySelectorAll(`[data-row="${this._hoveredRi}"]`)
3851
+ for (let i = 0; i < newEls.length; i++) {
3852
+ newEls[i].classList.add('eg-row--hover')
3853
+ }
3854
+ }
3855
+ }
3856
+ },
3857
+
3858
+ onGridMouseLeave() {
3859
+ if (this._hoveredRi >= 0) {
3860
+ if (this.$refs.wrapper) {
3861
+ const oldEls = this.$refs.wrapper.querySelectorAll(`[data-row="${this._hoveredRi}"]`)
3862
+ for (let i = 0; i < oldEls.length; i++) {
3863
+ oldEls[i].classList.remove('eg-row--hover')
3864
+ }
3865
+ }
3866
+ this._hoveredRi = -1
3867
+ }
3868
+ },
3869
+
3827
3870
  // =========================================================
3828
3871
  // KEYBOARD NAVIGATION (3.2)
3829
3872
  // =========================================================
@@ -7232,7 +7275,7 @@ export default ExcelGridComponent
7232
7275
  --eg-color-checkbox-disabled-checked-default: #bfbfbf;
7233
7276
 
7234
7277
  /* --- Row effects (off by default) --- */
7235
- --eg-color-row-hover-default: transparent;
7278
+ --eg-color-row-hover-default: #F1F1F1;
7236
7279
  --eg-color-row-stripe-default: transparent;
7237
7280
 
7238
7281
  box-sizing: border-box;
@@ -8506,7 +8549,12 @@ export default ExcelGridComponent
8506
8549
  .eg-row--even .eg-cell:not(.eg-cell-selected):not(.eg-cell-active):not(.eg-cell-fill-preview) {
8507
8550
  background: var(--eg-color-row-stripe, var(--eg-color-row-stripe-default));
8508
8551
  }
8509
- .eg-row:hover .eg-cell:not(.eg-cell-selected):not(.eg-cell-active):not(.eg-cell-fill-preview) {
8552
+ .eg-row:hover .eg-cell:not(.eg-cell-selected):not(.eg-cell-active):not(.eg-cell-fill-preview),
8553
+ .eg-row.eg-row--hover .eg-cell:not(.eg-cell-selected):not(.eg-cell-active):not(.eg-cell-fill-preview) {
8554
+ background: var(--eg-color-row-hover, var(--eg-color-row-hover-default));
8555
+ }
8556
+ .eg-row-header-cell:hover,
8557
+ .eg-row-header-cell.eg-row--hover {
8510
8558
  background: var(--eg-color-row-hover, var(--eg-color-row-hover-default));
8511
8559
  }
8512
8560