@vesture/react 0.2.6 → 0.2.7

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ButtonHTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, ReactNode, HTMLAttributes, ReactElement, MutableRefObject, AnchorHTMLAttributes, ForwardedRef, CSSProperties } from 'react';
2
+ import { ButtonHTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, ReactNode, HTMLAttributes, ReactElement, MutableRefObject, AnchorHTMLAttributes, MouseEvent, ForwardedRef, CSSProperties } from 'react';
3
3
  import { Placement } from '@floating-ui/react';
4
4
  export { defaultThemeClass, defaultThemeVars, vars } from '@vesture/tokens';
5
5
 
@@ -336,6 +336,9 @@ interface DataGridProps<T> {
336
336
  onPageChange?: (page: number) => void;
337
337
  /** Renders an "Export" button in the grid's toolbar that exports the current view to Excel. */
338
338
  enableExport?: boolean;
339
+ onRowClick?: (row: T, event: MouseEvent<HTMLDivElement>) => void;
340
+ onRowDoubleClick?: (row: T, event: MouseEvent<HTMLDivElement>) => void;
341
+ onCellClick?: (row: T, column: DataGridColumn<T>, event: MouseEvent<HTMLDivElement>) => void;
339
342
  }
340
343
  interface DataGridExportOptions {
341
344
  filename?: string;
package/dist/index.js CHANGED
@@ -1228,7 +1228,10 @@ function DataGridInner({
1228
1228
  page,
1229
1229
  pageSize,
1230
1230
  onPageChange,
1231
- enableExport = false
1231
+ enableExport = false,
1232
+ onRowClick,
1233
+ onRowDoubleClick,
1234
+ onCellClick
1232
1235
  }, ref) {
1233
1236
  const [uncontrolledSort, setUncontrolledSort] = useState8(
1234
1237
  null
@@ -1672,6 +1675,8 @@ function DataGridInner({
1672
1675
  role: "row",
1673
1676
  "data-selected": isSelected || void 0,
1674
1677
  "data-editing": isEditing || void 0,
1678
+ onClick: onRowClick ? (e) => onRowClick(rowData, e) : void 0,
1679
+ onDoubleClick: onRowDoubleClick ? (e) => onRowDoubleClick(rowData, e) : void 0,
1675
1680
  children: [
1676
1681
  selectable ? /* @__PURE__ */ jsx34(
1677
1682
  "div",
@@ -1679,6 +1684,7 @@ function DataGridInner({
1679
1684
  className: [checkboxCell, pinnedCell].join(" "),
1680
1685
  style: { left: 0 },
1681
1686
  role: "cell",
1687
+ onClick: (e) => e.stopPropagation(),
1682
1688
  children: /* @__PURE__ */ jsx34(
1683
1689
  "input",
1684
1690
  {
@@ -1699,6 +1705,7 @@ function DataGridInner({
1699
1705
  ...pinnedStyle(column)
1700
1706
  },
1701
1707
  role: "cell",
1708
+ onClick: onCellClick ? (e) => onCellClick(rowData, column, e) : void 0,
1702
1709
  children: isEditing && column.editable ? /* @__PURE__ */ jsx34(
1703
1710
  "input",
1704
1711
  {
@@ -1726,6 +1733,7 @@ function DataGridInner({
1726
1733
  className: [actionsCell, pinnedCell].join(" "),
1727
1734
  style: { right: 0 },
1728
1735
  role: "cell",
1736
+ onClick: (e) => e.stopPropagation(),
1729
1737
  children: isEditing ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
1730
1738
  /* @__PURE__ */ jsx34(
1731
1739
  "button",