@moontra/moonui-pro 2.26.40 → 2.26.42

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
@@ -73972,6 +73972,14 @@ function DataTable({
73972
73972
  const expandedRows = controlledExpandedRows || internalExpandedRows;
73973
73973
  const actualPageSize = defaultPageSize || pageSize;
73974
73974
  const stableData = t__default.useMemo(() => data, [data]);
73975
+ t__default.useEffect(() => {
73976
+ if (onRowSelect) {
73977
+ const selectedRows = Object.keys(rowSelection).filter((key) => rowSelection[key]).map((index2) => stableData[parseInt(index2)]).filter(Boolean);
73978
+ setTimeout(() => {
73979
+ onRowSelect(selectedRows);
73980
+ }, 0);
73981
+ }
73982
+ }, [rowSelection, stableData, onRowSelect]);
73975
73983
  const createSortingHandler = (columnId) => {
73976
73984
  return () => {
73977
73985
  const currentSorting = externalState?.sorting ?? sorting;
@@ -74001,40 +74009,23 @@ function DataTable({
74001
74009
  const checkboxColumn = {
74002
74010
  id: "select",
74003
74011
  header: ({ table: table2 }) => {
74004
- const allRowIds = table2.getRowModel().rows.map((row) => row.id);
74005
- const isAllSelected = allRowIds.length > 0 && allRowIds.every((id) => rowSelection[id]);
74006
- const isSomeSelected = allRowIds.some((id) => rowSelection[id]);
74007
74012
  return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
74008
74013
  MoonUICheckboxPro,
74009
74014
  {
74010
- checked: isAllSelected ? true : isSomeSelected ? "indeterminate" : false,
74011
- onCheckedChange: (value) => {
74012
- const newSelection = {};
74013
- if (value) {
74014
- allRowIds.forEach((id) => {
74015
- newSelection[id] = true;
74016
- });
74017
- }
74018
- setRowSelection(newSelection);
74019
- },
74015
+ checked: table2.getIsAllPageRowsSelected() || table2.getIsSomePageRowsSelected() && "indeterminate",
74016
+ onCheckedChange: (value) => table2.toggleAllPageRowsSelected(!!value),
74020
74017
  "aria-label": "Select all",
74021
74018
  className: "h-4 w-4"
74022
74019
  }
74023
74020
  ) });
74024
74021
  },
74025
74022
  cell: ({ row }) => {
74026
- const rowId = row.id;
74027
- const isSelected = !!rowSelection[rowId];
74028
74023
  return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
74029
74024
  MoonUICheckboxPro,
74030
74025
  {
74031
- checked: isSelected,
74032
- onCheckedChange: (value) => {
74033
- setRowSelection((prev) => ({
74034
- ...prev,
74035
- [rowId]: !!value
74036
- }));
74037
- },
74026
+ checked: row.getIsSelected(),
74027
+ onCheckedChange: (value) => row.toggleSelected(!!value),
74028
+ disabled: !row.getCanSelect(),
74038
74029
  "aria-label": "Select row",
74039
74030
  className: "h-4 w-4"
74040
74031
  }
@@ -74140,12 +74131,10 @@ function DataTable({
74140
74131
  manualPagination,
74141
74132
  pageCount,
74142
74133
  state: {
74143
- ...externalState || {},
74144
74134
  sorting: externalState?.sorting ?? sorting,
74145
74135
  columnFilters: externalState?.columnFilters ?? columnFilters,
74146
74136
  columnVisibility: externalState?.columnVisibility ?? columnVisibility,
74147
- rowSelection,
74148
- // Always use internal rowSelection state
74137
+ rowSelection: externalState?.rowSelection ?? rowSelection,
74149
74138
  globalFilter: externalState?.globalFilter ?? globalFilter,
74150
74139
  pagination: externalState?.pagination ?? paginationState
74151
74140
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.26.40",
3
+ "version": "2.26.42",
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",