@moontra/moonui-pro 2.26.44 → 2.26.46
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.global.js +76 -76
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +17 -31
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -73972,12 +73972,6 @@ 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
|
-
onRowSelect(selectedRows);
|
|
73979
|
-
}
|
|
73980
|
-
}, [rowSelection, stableData, onRowSelect]);
|
|
73981
73975
|
const createSortingHandler = (columnId) => {
|
|
73982
73976
|
return () => {
|
|
73983
73977
|
const currentSorting = externalState?.sorting ?? sorting;
|
|
@@ -73996,6 +73990,13 @@ function DataTable({
|
|
|
73996
73990
|
}
|
|
73997
73991
|
};
|
|
73998
73992
|
};
|
|
73993
|
+
const handleRowSelectionChange = t__default.useCallback((newSelection) => {
|
|
73994
|
+
setRowSelection(newSelection);
|
|
73995
|
+
if (onRowSelect) {
|
|
73996
|
+
const selectedRows = Object.keys(newSelection).filter((key) => newSelection[key]).map((index2) => stableData[parseInt(index2)]).filter(Boolean);
|
|
73997
|
+
setTimeout(() => onRowSelect(selectedRows), 0);
|
|
73998
|
+
}
|
|
73999
|
+
}, [stableData, onRowSelect]);
|
|
73999
74000
|
const processedColumns = t__default.useMemo(() => {
|
|
74000
74001
|
let cols = columns.map((col) => {
|
|
74001
74002
|
if (!col.id && col.accessorKey) {
|
|
@@ -74007,41 +74008,23 @@ function DataTable({
|
|
|
74007
74008
|
const checkboxColumn = {
|
|
74008
74009
|
id: "select",
|
|
74009
74010
|
header: ({ table: table2 }) => {
|
|
74010
|
-
const allRows = table2.getFilteredRowModel().rows;
|
|
74011
|
-
const selectedCount = Object.keys(rowSelection).filter((key) => rowSelection[key]).length;
|
|
74012
|
-
const isAllSelected = allRows.length > 0 && selectedCount === allRows.length;
|
|
74013
|
-
const isSomeSelected = selectedCount > 0 && selectedCount < allRows.length;
|
|
74014
74011
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
74015
74012
|
MoonUICheckboxPro,
|
|
74016
74013
|
{
|
|
74017
|
-
checked:
|
|
74018
|
-
onCheckedChange: (value) =>
|
|
74019
|
-
const newSelection = {};
|
|
74020
|
-
if (value) {
|
|
74021
|
-
allRows.forEach((row, index2) => {
|
|
74022
|
-
newSelection[index2.toString()] = true;
|
|
74023
|
-
});
|
|
74024
|
-
}
|
|
74025
|
-
setRowSelection(newSelection);
|
|
74026
|
-
},
|
|
74014
|
+
checked: table2.getIsAllPageRowsSelected() || table2.getIsSomePageRowsSelected() && "indeterminate",
|
|
74015
|
+
onCheckedChange: (value) => table2.toggleAllPageRowsSelected(!!value),
|
|
74027
74016
|
"aria-label": "Select all",
|
|
74028
74017
|
className: "h-4 w-4"
|
|
74029
74018
|
}
|
|
74030
74019
|
) });
|
|
74031
74020
|
},
|
|
74032
74021
|
cell: ({ row }) => {
|
|
74033
|
-
const rowIndex = row.index.toString();
|
|
74034
|
-
const isChecked = !!rowSelection[rowIndex];
|
|
74035
74022
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
74036
74023
|
MoonUICheckboxPro,
|
|
74037
74024
|
{
|
|
74038
|
-
checked:
|
|
74039
|
-
onCheckedChange: (value) =>
|
|
74040
|
-
|
|
74041
|
-
...prev,
|
|
74042
|
-
[rowIndex]: !!value
|
|
74043
|
-
}));
|
|
74044
|
-
},
|
|
74025
|
+
checked: row.getIsSelected(),
|
|
74026
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
74027
|
+
disabled: !row.getCanSelect(),
|
|
74045
74028
|
"aria-label": "Select row",
|
|
74046
74029
|
className: "h-4 w-4"
|
|
74047
74030
|
}
|
|
@@ -74055,7 +74038,7 @@ function DataTable({
|
|
|
74055
74038
|
cols = [checkboxColumn, ...cols];
|
|
74056
74039
|
}
|
|
74057
74040
|
return cols;
|
|
74058
|
-
}, [columns, selectable, enableRowSelection
|
|
74041
|
+
}, [columns, selectable, enableRowSelection]);
|
|
74059
74042
|
const table = useReactTable({
|
|
74060
74043
|
data: stableData,
|
|
74061
74044
|
columns: processedColumns,
|
|
@@ -74074,7 +74057,10 @@ function DataTable({
|
|
|
74074
74057
|
sortDescFirst: false,
|
|
74075
74058
|
// First click should be ascending
|
|
74076
74059
|
onColumnVisibilityChange: setColumnVisibility,
|
|
74077
|
-
onRowSelectionChange:
|
|
74060
|
+
onRowSelectionChange: (updater) => {
|
|
74061
|
+
const newSelection = typeof updater === "function" ? updater(rowSelection) : updater;
|
|
74062
|
+
handleRowSelectionChange(newSelection);
|
|
74063
|
+
},
|
|
74078
74064
|
onGlobalFilterChange: setGlobalFilter,
|
|
74079
74065
|
globalFilterFn: "includesString",
|
|
74080
74066
|
enableRowSelection: selectable || enableRowSelection || false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.46",
|
|
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",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"react-dom": ">=18.0.0 || ^19.0.0"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
+
"@moontra/moonui-pro": "^2.26.44",
|
|
84
85
|
"@radix-ui/react-accordion": "^1.2.11",
|
|
85
86
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
86
87
|
"@radix-ui/react-checkbox": "^1.3.2",
|