@seanyeh77/ui 0.52.0 → 0.53.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.
@@ -69,8 +69,9 @@ export interface DataTableProps<R extends Row = Record<string, unknown>> {
69
69
  * links, buttons or checkbox, nor a click that ends a text selection) opens it. Like a link, Ctrl, ⌘ or Shift + click
70
70
  * and a middle click open it in a new tab. */
71
71
  rowHref?: (row: R) => string;
72
- /** With rowHref: called instead of following the link on a plain click (on the row or its first cell's link), so an
73
- * app router can push the route. Ctrl, ⌘, Shift and middle clicks still open the href in a new tab. */
72
+ /** With rowHref (alone it does nothing, and development warns): called instead of following the link on a plain
73
+ * click (on the row or its first cell's link), so an app router can push the route. Ctrl, ⌘, Shift and middle clicks
74
+ * still open the href in a new tab. */
74
75
  onRowOpen?: (row: R, event: React.MouseEvent) => void;
75
76
  /** Write search and filters into the URL. Default true. */
76
77
  urlSync?: boolean;
@@ -311,6 +311,7 @@ function DataTable(p) {
311
311
  React.useEffect(() => {
312
312
  if (urlSync && filters.length) writeUrl(urlKey, filters, values, q);
313
313
  }, [valuesKey, q]);
314
+ devWarn(p.onRowOpen !== void 0 && p.rowHref === void 0, "DataTable", "onRowOpen is only called with rowHref, so clicking a row does nothing. Pass rowHref too: it gives each row a link that keyboard users can open, and onRowOpen still takes the plain click (e.g. for a router).");
314
315
  devWarn(p.widthKey !== void 0, "DataTable", "`widthKey` is deprecated: rename it to `storageKey`, as in every other component that remembers a choice. The stored widths and columns carry over.");
315
316
  devWarn(() => cols.some((c) => c.format === "percent" && !c.unit), "DataTable", "format: 'percent' sets 1 decimal and shows no % sign; add unit: '%' to that column.");
316
317
  devWarn(() => rows.length > 1 && rows.every((r) => get(r, "id") == null) && selectable, "DataTable", "rows have no id, so a selection follows the position, not the row. Add an id to each row.");