@rufous/ui 0.2.82 → 0.2.83

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/main.cjs CHANGED
@@ -4303,7 +4303,9 @@ function DataGrid({
4303
4303
  pageSizeOptions = [5, 10, 25, 50],
4304
4304
  title,
4305
4305
  className,
4306
- sx
4306
+ sx,
4307
+ onRowDoubleClick,
4308
+ onCellDoubleClick
4307
4309
  }) {
4308
4310
  const sxClass = useSx(sx);
4309
4311
  const [columnOverrides, setColumnOverrides] = (0, import_react23.useState)({});
@@ -4681,7 +4683,7 @@ function DataGrid({
4681
4683
  }
4682
4684
  )))
4683
4685
  );
4684
- }), actions && /* @__PURE__ */ import_react23.default.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ import_react23.default.createElement("tbody", null, paginatedData.length === 0 ? /* @__PURE__ */ import_react23.default.createElement("tr", null, /* @__PURE__ */ import_react23.default.createElement("td", { colSpan: visibleColumns.length + (actions ? 1 : 0), className: "dg-empty" }, "No records found")) : paginatedData.map((item) => /* @__PURE__ */ import_react23.default.createElement("tr", { key: item.id, className: "dg-tbody-row" }, visibleColumns.map((col, idx) => {
4686
+ }), actions && /* @__PURE__ */ import_react23.default.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ import_react23.default.createElement("tbody", null, paginatedData.length === 0 ? /* @__PURE__ */ import_react23.default.createElement("tr", null, /* @__PURE__ */ import_react23.default.createElement("td", { colSpan: visibleColumns.length + (actions ? 1 : 0), className: "dg-empty" }, "No records found")) : paginatedData.map((item) => /* @__PURE__ */ import_react23.default.createElement("tr", { key: item.id, className: "dg-tbody-row", onDoubleClick: () => onRowDoubleClick?.(item) }, visibleColumns.map((col, idx) => {
4685
4687
  const colField = String(col.field);
4686
4688
  const width = columnWidths[colField] || 200;
4687
4689
  const leftOffset = getLeftOffset(col, idx);
@@ -4691,7 +4693,8 @@ function DataGrid({
4691
4693
  {
4692
4694
  key: `${item.id}-${colField}`,
4693
4695
  className: `dg-td${col.pinned === "left" ? " pinned-left" : col.pinned === "right" ? " pinned-right" : ""} ${col.cellClassName || ""}`,
4694
- style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex }
4696
+ style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex },
4697
+ onDoubleClick: () => onCellDoubleClick?.({ row: item, field: colField, value: item[col.field || ""] })
4695
4698
  },
4696
4699
  (() => {
4697
4700
  const field = String(col.field);
package/dist/main.d.cts CHANGED
@@ -818,11 +818,17 @@ interface DataGridProps<T> {
818
818
  title?: string;
819
819
  className?: string;
820
820
  sx?: SxProp;
821
+ onRowDoubleClick?: (row: T) => void;
822
+ onCellDoubleClick?: (params: {
823
+ row: T;
824
+ field: string;
825
+ value: any;
826
+ }) => void;
821
827
  }
822
828
 
823
829
  declare function DataGrid<T extends {
824
830
  id: string | number;
825
- }>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, }: DataGridProps<T>): React__default.JSX.Element;
831
+ }>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, }: DataGridProps<T>): React__default.JSX.Element;
826
832
 
827
833
  type SelectOption = {
828
834
  value: string | number;
package/dist/main.d.ts CHANGED
@@ -818,11 +818,17 @@ interface DataGridProps<T> {
818
818
  title?: string;
819
819
  className?: string;
820
820
  sx?: SxProp;
821
+ onRowDoubleClick?: (row: T) => void;
822
+ onCellDoubleClick?: (params: {
823
+ row: T;
824
+ field: string;
825
+ value: any;
826
+ }) => void;
821
827
  }
822
828
 
823
829
  declare function DataGrid<T extends {
824
830
  id: string | number;
825
- }>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, }: DataGridProps<T>): React__default.JSX.Element;
831
+ }>({ columns: initialColumnsProp, data, actions, pageSize: initialPageSize, pageSizeOptions, title, className, sx, onRowDoubleClick, onCellDoubleClick, }: DataGridProps<T>): React__default.JSX.Element;
826
832
 
827
833
  type SelectOption = {
828
834
  value: string | number;
package/dist/main.js CHANGED
@@ -4173,7 +4173,9 @@ function DataGrid({
4173
4173
  pageSizeOptions = [5, 10, 25, 50],
4174
4174
  title,
4175
4175
  className,
4176
- sx
4176
+ sx,
4177
+ onRowDoubleClick,
4178
+ onCellDoubleClick
4177
4179
  }) {
4178
4180
  const sxClass = useSx(sx);
4179
4181
  const [columnOverrides, setColumnOverrides] = useState9({});
@@ -4551,7 +4553,7 @@ function DataGrid({
4551
4553
  }
4552
4554
  )))
4553
4555
  );
4554
- }), actions && /* @__PURE__ */ React75.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ React75.createElement("tbody", null, paginatedData.length === 0 ? /* @__PURE__ */ React75.createElement("tr", null, /* @__PURE__ */ React75.createElement("td", { colSpan: visibleColumns.length + (actions ? 1 : 0), className: "dg-empty" }, "No records found")) : paginatedData.map((item) => /* @__PURE__ */ React75.createElement("tr", { key: item.id, className: "dg-tbody-row" }, visibleColumns.map((col, idx) => {
4556
+ }), actions && /* @__PURE__ */ React75.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ React75.createElement("tbody", null, paginatedData.length === 0 ? /* @__PURE__ */ React75.createElement("tr", null, /* @__PURE__ */ React75.createElement("td", { colSpan: visibleColumns.length + (actions ? 1 : 0), className: "dg-empty" }, "No records found")) : paginatedData.map((item) => /* @__PURE__ */ React75.createElement("tr", { key: item.id, className: "dg-tbody-row", onDoubleClick: () => onRowDoubleClick?.(item) }, visibleColumns.map((col, idx) => {
4555
4557
  const colField = String(col.field);
4556
4558
  const width = columnWidths[colField] || 200;
4557
4559
  const leftOffset = getLeftOffset(col, idx);
@@ -4561,7 +4563,8 @@ function DataGrid({
4561
4563
  {
4562
4564
  key: `${item.id}-${colField}`,
4563
4565
  className: `dg-td${col.pinned === "left" ? " pinned-left" : col.pinned === "right" ? " pinned-right" : ""} ${col.cellClassName || ""}`,
4564
- style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex }
4566
+ style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex },
4567
+ onDoubleClick: () => onCellDoubleClick?.({ row: item, field: colField, value: item[col.field || ""] })
4565
4568
  },
4566
4569
  (() => {
4567
4570
  const field = String(col.field);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rufous/ui",
3
3
  "private": false,
4
- "version": "0.2.82",
4
+ "version": "0.2.83",
5
5
  "type": "module",
6
6
  "description": "Experimental: A lightweight React UI component library (Beta)",
7
7
  "style": "./dist/main.css",