sliftutils 0.16.0 → 0.17.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/index.d.ts CHANGED
@@ -317,6 +317,7 @@ declare module "sliftutils/render-utils/Table" {
317
317
  lineLimit?: number;
318
318
  characterLimit?: number;
319
319
  excludeEmptyColumns?: boolean;
320
+ rowClassName?: (row: RowT) => string;
320
321
  }> {
321
322
  state: {
322
323
  limit: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -24,6 +24,7 @@ export declare class Table<RowT extends RowType> extends preact.Component<TableT
24
24
  lineLimit?: number;
25
25
  characterLimit?: number;
26
26
  excludeEmptyColumns?: boolean;
27
+ rowClassName?: (row: RowT) => string;
27
28
  }> {
28
29
  state: {
29
30
  limit: number;
@@ -32,6 +32,8 @@ export class Table<RowT extends RowType> extends preact.Component<TableType<RowT
32
32
  characterLimit?: number;
33
33
 
34
34
  excludeEmptyColumns?: boolean;
35
+
36
+ rowClassName?: (row: RowT) => string
35
37
  }> {
36
38
  state = {
37
39
  limit: this.props.initialLimit || 100,
@@ -65,7 +67,7 @@ export class Table<RowT extends RowType> extends preact.Component<TableType<RowT
65
67
  </tr>
66
68
  {rows.map((row, index) => (
67
69
  <tr
68
- className={(index % 2 === 1 && css.hsla(0, 0, 100, 0.25) || "")}
70
+ className={(this.props.rowClassName?.(row) || "") + (index % 2 === 1 && css.hsla(0, 0, 100, 0.25) || "")}
69
71
  >
70
72
  <td className={css.center}>{index + 1}</td>
71
73
  {Object.entries(columns).filter(x => x[1] !== null).map(([columnName, column]: [string, ColumnType]) => {