@moontra/moonui-pro 2.26.21 → 2.26.23

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.mjs CHANGED
@@ -73991,13 +73991,41 @@ function DataTable({
73991
73991
  };
73992
73992
  };
73993
73993
  const processedColumns = t__default.useMemo(() => {
73994
- return columns.map((col) => {
73994
+ let cols = columns.map((col) => {
73995
73995
  if (!col.id && col.accessorKey) {
73996
73996
  return { ...col, id: col.accessorKey };
73997
73997
  }
73998
73998
  return col;
73999
73999
  });
74000
- }, [columns]);
74000
+ if (selectable || enableRowSelection) {
74001
+ const checkboxColumn = {
74002
+ id: "select",
74003
+ header: ({ table: table2 }) => /* @__PURE__ */ jsx(
74004
+ "input",
74005
+ {
74006
+ type: "checkbox",
74007
+ checked: table2.getIsAllPageRowsSelected(),
74008
+ onChange: (e) => table2.toggleAllPageRowsSelected(e.target.checked),
74009
+ className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
74010
+ }
74011
+ ),
74012
+ cell: ({ row }) => /* @__PURE__ */ jsx(
74013
+ "input",
74014
+ {
74015
+ type: "checkbox",
74016
+ checked: row.getIsSelected(),
74017
+ onChange: (e) => row.toggleSelected(e.target.checked),
74018
+ className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"
74019
+ }
74020
+ ),
74021
+ enableSorting: false,
74022
+ enableHiding: false,
74023
+ size: 32
74024
+ };
74025
+ cols = [checkboxColumn, ...cols];
74026
+ }
74027
+ return cols;
74028
+ }, [columns, selectable, enableRowSelection]);
74001
74029
  const table = useReactTable({
74002
74030
  data: stableData,
74003
74031
  columns: processedColumns,
@@ -74107,12 +74135,14 @@ function DataTable({
74107
74135
  autoResetExpanded: false,
74108
74136
  getRowId: (row) => row.id || row.orderId || Math.random().toString()
74109
74137
  });
74138
+ const prevRowSelectionRef = t__default.useRef(rowSelection);
74110
74139
  t__default.useEffect(() => {
74111
- if (onRowSelect && selectable) {
74140
+ if (onRowSelect && selectable && prevRowSelectionRef.current !== rowSelection) {
74141
+ prevRowSelectionRef.current = rowSelection;
74112
74142
  const selectedRows = table.getFilteredSelectedRowModel().rows.map((row) => row.original);
74113
74143
  onRowSelect(selectedRows);
74114
74144
  }
74115
- }, [rowSelection, onRowSelect, selectable, table]);
74145
+ }, [rowSelection, selectable]);
74116
74146
  table.getState();
74117
74147
  const rowModel = table.getRowModel();
74118
74148
  const rowsRef = t__default.useRef(rowModel.rows);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.26.21",
3
+ "version": "2.26.23",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",