vue2-excel-grid 2.4.0 → 2.5.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": "vue2-excel-grid",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Excel-style grid component for Vue 2.6.14 with virtual scrolling",
5
5
  "license": "MIT",
6
6
  "author": "Fozilbek Raimberdiyev",
@@ -556,7 +556,7 @@
556
556
  class="eg-cell"
557
557
  :data-fi="ci"
558
558
  :class="getCellClasses(ri, ci)"
559
- :style="getCellStyle(ri, ci)"
559
+ :style="[getCellStyle(ri, ci), getRowCustomStyle(ri)]"
560
560
  @mousedown="onCellMouseDown($event, ri, ci)"
561
561
  @mouseover="onCellMouseOver($event, ri, ci)"
562
562
  @mouseup="onCellMouseUp"
@@ -615,7 +615,7 @@
615
615
  class="eg-cell"
616
616
  :data-fi="ci"
617
617
  :class="getCellClasses(ri, ci)"
618
- :style="getCellStyle(ri, ci)"
618
+ :style="[getCellStyle(ri, ci), getRowCustomStyle(ri)]"
619
619
  @mousedown="onCellMouseDown($event, ri, ci)"
620
620
  @mouseover="onCellMouseOver($event, ri, ci)"
621
621
  @mouseup="onCellMouseUp"
@@ -674,7 +674,7 @@
674
674
  class="eg-cell"
675
675
  :data-fi="col._flatIndex"
676
676
  :class="getCellClasses(ri, col._flatIndex)"
677
- :style="getCellStyle(ri, col._flatIndex)"
677
+ :style="[getCellStyle(ri, col._flatIndex), getRowCustomStyle(ri)]"
678
678
  @mousedown="onCellMouseDown($event, ri, col._flatIndex)"
679
679
  @mouseover="onCellMouseOver($event, ri, col._flatIndex)"
680
680
  @mouseup="onCellMouseUp"
@@ -1361,6 +1361,24 @@ const ExcelGridComponent = {
1361
1361
  */
1362
1362
  loading: { type: Boolean, default: false },
1363
1363
 
1364
+ /**
1365
+ * Data-driven per-row styling: `(row, rowIndex) => styleObject`. The
1366
+ * returned style object is applied to every cell in that row (across
1367
+ * the frozen/scrollable/pinned-right zones alike), giving the row a
1368
+ * continuous horizontal background/style without any host-side CSS.
1369
+ * Selection/active/fill-preview/readonly cell highlighting keeps
1370
+ * winning visually — those already use `!important`, which always
1371
+ * beats a plain (non-`!important`) inline style. Doesn't affect the
1372
+ * row-number header column (mirrors Excel: conditional formatting
1373
+ * colors data cells, not the row gutter). Return `null`/`undefined`
1374
+ * for rows that shouldn't get a custom style.
1375
+ * @type {Function}
1376
+ * @default null
1377
+ * @example
1378
+ * <excel-grid :columns="columns" v-model="data" :row-style="(row) => row.status === 'error' ? { background: '#fde2e2' } : null" />
1379
+ */
1380
+ rowStyle: { type: Function, default: null },
1381
+
1364
1382
  /** Show "Column info" / "Row info" items in the context menu (dev/debug aid). */
1365
1383
  devMode: { type: Boolean, default: false },
1366
1384
 
@@ -3122,6 +3140,17 @@ const ExcelGridComponent = {
3122
3140
  return style
3123
3141
  },
3124
3142
 
3143
+ // rowStyle prop — deliberately NOT merged into getCellStyle()'s return value:
3144
+ // that object is cached/shared by (w,h,left) across unrelated rows/cells (see
3145
+ // comment above), so mutating it here would leak one row's style onto every
3146
+ // other cell that happens to share the same cache key. Kept as a second,
3147
+ // uncached :style array entry instead (see template) — cheap, and correctly
3148
+ // reactive to the row's actual data instead of just its geometry.
3149
+ getRowCustomStyle(ri) {
3150
+ if (!this.rowStyle) return null
3151
+ return this.rowStyle(this._dataRaw[ri], ri) || null
3152
+ },
3153
+
3125
3154
  getCellClasses(ri, ci) {
3126
3155
  const col = this.leafCols[ci]
3127
3156
  const active = this.isActiveCell(ri, ci)