twico-ui 1.44.0 → 1.45.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to Twico UI are documented here (newest first). This file is generated automatically on each release by [semantic-release](https://semantic-release.gitbook.io/) from [Conventional Commits](https://www.conventionalcommits.org/) — do not edit it by hand. The same notes appear on each [GitHub Release](https://github.com/EncryptionL/twico-ui/releases).
4
4
 
5
+ # [1.45.0](https://github.com/EncryptionL/twico-ui/compare/v1.44.0...v1.45.0) (2026-10-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **datatable:** lift getRowStyle's background off the <tr> instead of copying it ([e54165e](https://github.com/EncryptionL/twico-ui/commit/e54165e918dad9d8f0f819890ebb718684bdfc07)), closes [#242](https://github.com/EncryptionL/twico-ui/issues/242) [#481](https://github.com/EncryptionL/twico-ui/issues/481)
11
+
12
+
13
+ ### Features
14
+
15
+ * **datatable:** getRowStyle / getRowClassName — row-level style hooks ([56a80e8](https://github.com/EncryptionL/twico-ui/commit/56a80e8c7adeb293923b5f2e490cf62234df3a3a)), closes [#345](https://github.com/EncryptionL/twico-ui/issues/345) [#242](https://github.com/EncryptionL/twico-ui/issues/242)
16
+
5
17
  # [1.44.0](https://github.com/EncryptionL/twico-ui/compare/v1.43.0...v1.44.0) (2026-10-16)
6
18
 
7
19
 
package/dist/index.cjs CHANGED
@@ -9252,8 +9252,22 @@ var DT_CSS = `
9252
9252
  .twc-dt__row:hover .twc-dt__row-resizer::after { background: var(--color-border-strong); }
9253
9253
  .twc-dt__row-resizer:hover::after { background: var(--color-primary); }
9254
9254
 
9255
+ /* #481: the cell background reads --twc-dt-row-bg, which getRowStyle sets on the <tr>. It has to come
9256
+ through a custom property rather than straight off the row, because this rule paints an OPAQUE
9257
+ --color-surface on every cell: a background set on the <tr> would sit behind it and never show,
9258
+ which would make the commonest use of a row-style hook silently do nothing. Cells in a pinned
9259
+ COLUMN inherit it too, so a tinted row does not develop a hole where a sticky column scrolls over
9260
+ it.
9261
+ Layering: this rule is (0,1,0), the LOWEST specificity of any background in this sheet, so the
9262
+ row tint is the bottom layer above the plain surface and every built-in state covers it - hover,
9263
+ row selection, data-active, data-pinned-row, data-row-grabbed, the diff data-op washes, cell
9264
+ selection/active, inline editing (each (0,3,0), (0,4,0) for the pinned-column twins, or (0,2,0)
9265
+ for the cell-level ones) - and an inline per-cell cellStyle
9266
+ covers them all. That is the intended rule, not an accident of ordering: a row tint is a
9267
+ data-derived wash, and no data wash should be able to hide an interaction state. Consumers who
9268
+ need a tint that outranks those use getRowClassName and a rule of their own. */
9255
9269
  .twc-dt__td { padding: 0 12px; height: var(--_rowh, 44px); border-bottom: var(--border-thin) solid var(--color-divider);
9256
- font-size: var(--text-sm); color: var(--color-text); background: var(--color-surface);
9270
+ font-size: var(--text-sm); color: var(--color-text); background: var(--twc-dt-row-bg, var(--color-surface));
9257
9271
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
9258
9272
  /* Wrap-text columns: content flows onto multiple lines (the row grows down) instead of
9259
9273
  clipping to one line. height stays a per-row minimum, so single-line cells are unchanged. */
@@ -10020,6 +10034,8 @@ function Datatable({
10020
10034
  onColumnVisibilityChange,
10021
10035
  batchActions = [],
10022
10036
  onRowSelectionChange,
10037
+ getRowStyle,
10038
+ getRowClassName,
10023
10039
  showExport = false,
10024
10040
  showDensity = false,
10025
10041
  showPivot = false,
@@ -12595,7 +12611,17 @@ function Datatable({
12595
12611
  const rowActive = selectionMode === "row" && activeRowVal === k;
12596
12612
  const stickyStyle = pinSide === "top" ? { position: "sticky", top: headH, zIndex: 5 } : pinSide === "bottom" ? { position: "sticky", bottom: 0, zIndex: 5 } : void 0;
12597
12613
  const h = rowHeights[k];
12598
- const rowStyle = { ...stickyStyle || {}, ...h ? { height: h } : {} };
12614
+ const userRowStyle = getRowStyle ? getRowStyle(row, ri) : void 0;
12615
+ const userRowClass = getRowClassName ? getRowClassName(row, ri) : void 0;
12616
+ const { background: _rowBgShorthand, backgroundColor: _rowBgColor, ...restRowStyle } = userRowStyle || {};
12617
+ const usable = (v) => typeof v === "string" && v.trim() !== "" ? v : void 0;
12618
+ const rowBg = usable(_rowBgShorthand) ?? usable(_rowBgColor);
12619
+ const rowStyle = {
12620
+ ...restRowStyle,
12621
+ ...rowBg != null ? { "--twc-dt-row-bg": rowBg } : {},
12622
+ ...stickyStyle || {},
12623
+ ...h ? { height: h } : {}
12624
+ };
12599
12625
  const reorderable = canReorderRows && !pinSide;
12600
12626
  const grabbed = rowGrab && rowGrab.key === k;
12601
12627
  const grabTarget = rowGrab && !grabbed && midIdx != null && rowGrab.index === midIdx ? rowGrab.index >= keyIndexMid.get(rowGrab.key) ? "after" : "before" : void 0;
@@ -12603,7 +12629,7 @@ function Datatable({
12603
12629
  /* @__PURE__ */ jsxRuntime.jsxs(
12604
12630
  "tr",
12605
12631
  {
12606
- className: "twc-dt__row",
12632
+ className: userRowClass ? `twc-dt__row ${userRowClass}` : "twc-dt__row",
12607
12633
  role: "row",
12608
12634
  "aria-rowindex": treeSeqByKey ? treeSeqByKey.get(k) + 2 : (paginated && !serverMode ? pageVal * sizeVal : 0) + ri + 2,
12609
12635
  "aria-selected": (checkboxSelection ? sel : rowActive) || void 0,