@moontra/moonui-pro 2.26.45 → 2.26.47
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 +75 -75
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +28 -42
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -73990,6 +73990,13 @@ function DataTable({
|
|
|
73990
73990
|
}
|
|
73991
73991
|
};
|
|
73992
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
|
+
onRowSelect(selectedRows);
|
|
73998
|
+
}
|
|
73999
|
+
}, [stableData, onRowSelect]);
|
|
73993
74000
|
const processedColumns = t__default.useMemo(() => {
|
|
73994
74001
|
let cols = columns.map((col) => {
|
|
73995
74002
|
if (!col.id && col.accessorKey) {
|
|
@@ -74001,50 +74008,23 @@ function DataTable({
|
|
|
74001
74008
|
const checkboxColumn = {
|
|
74002
74009
|
id: "select",
|
|
74003
74010
|
header: ({ table: table2 }) => {
|
|
74004
|
-
const allRows = table2.getFilteredRowModel().rows;
|
|
74005
|
-
const selectedCount = Object.keys(rowSelection).filter((key) => rowSelection[key]).length;
|
|
74006
|
-
const isAllSelected = allRows.length > 0 && selectedCount === allRows.length;
|
|
74007
|
-
const isSomeSelected = selectedCount > 0 && selectedCount < allRows.length;
|
|
74008
74011
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
74009
74012
|
MoonUICheckboxPro,
|
|
74010
74013
|
{
|
|
74011
|
-
checked:
|
|
74012
|
-
onCheckedChange: (value) =>
|
|
74013
|
-
const newSelection = {};
|
|
74014
|
-
if (value) {
|
|
74015
|
-
allRows.forEach((row, index2) => {
|
|
74016
|
-
newSelection[index2.toString()] = true;
|
|
74017
|
-
});
|
|
74018
|
-
}
|
|
74019
|
-
setRowSelection(newSelection);
|
|
74020
|
-
if (onRowSelect) {
|
|
74021
|
-
const selectedRows = value ? allRows.map((row) => row.original) : [];
|
|
74022
|
-
setTimeout(() => onRowSelect(selectedRows), 0);
|
|
74023
|
-
}
|
|
74024
|
-
},
|
|
74014
|
+
checked: table2.getIsAllPageRowsSelected() || table2.getIsSomePageRowsSelected() && "indeterminate",
|
|
74015
|
+
onCheckedChange: (value) => table2.toggleAllPageRowsSelected(!!value),
|
|
74025
74016
|
"aria-label": "Select all",
|
|
74026
74017
|
className: "h-4 w-4"
|
|
74027
74018
|
}
|
|
74028
74019
|
) });
|
|
74029
74020
|
},
|
|
74030
74021
|
cell: ({ row }) => {
|
|
74031
|
-
const rowIndex = row.index.toString();
|
|
74032
|
-
const isChecked = !!rowSelection[rowIndex];
|
|
74033
74022
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
74034
74023
|
MoonUICheckboxPro,
|
|
74035
74024
|
{
|
|
74036
|
-
checked:
|
|
74037
|
-
onCheckedChange: (value) =>
|
|
74038
|
-
|
|
74039
|
-
...rowSelection,
|
|
74040
|
-
[rowIndex]: !!value
|
|
74041
|
-
};
|
|
74042
|
-
setRowSelection(newSelection);
|
|
74043
|
-
if (onRowSelect) {
|
|
74044
|
-
const selectedRows = Object.keys(newSelection).filter((key) => newSelection[key]).map((index2) => stableData[parseInt(index2)]).filter(Boolean);
|
|
74045
|
-
setTimeout(() => onRowSelect(selectedRows), 0);
|
|
74046
|
-
}
|
|
74047
|
-
},
|
|
74025
|
+
checked: row.getIsSelected(),
|
|
74026
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
74027
|
+
disabled: !row.getCanSelect(),
|
|
74048
74028
|
"aria-label": "Select row",
|
|
74049
74029
|
className: "h-4 w-4"
|
|
74050
74030
|
}
|
|
@@ -74058,7 +74038,7 @@ function DataTable({
|
|
|
74058
74038
|
cols = [checkboxColumn, ...cols];
|
|
74059
74039
|
}
|
|
74060
74040
|
return cols;
|
|
74061
|
-
}, [columns, selectable, enableRowSelection
|
|
74041
|
+
}, [columns, selectable, enableRowSelection]);
|
|
74062
74042
|
const table = useReactTable({
|
|
74063
74043
|
data: stableData,
|
|
74064
74044
|
columns: processedColumns,
|
|
@@ -74077,7 +74057,10 @@ function DataTable({
|
|
|
74077
74057
|
sortDescFirst: false,
|
|
74078
74058
|
// First click should be ascending
|
|
74079
74059
|
onColumnVisibilityChange: setColumnVisibility,
|
|
74080
|
-
onRowSelectionChange:
|
|
74060
|
+
onRowSelectionChange: (updater) => {
|
|
74061
|
+
const newSelection = typeof updater === "function" ? updater(rowSelection) : updater;
|
|
74062
|
+
handleRowSelectionChange(newSelection);
|
|
74063
|
+
},
|
|
74081
74064
|
onGlobalFilterChange: setGlobalFilter,
|
|
74082
74065
|
globalFilterFn: "includesString",
|
|
74083
74066
|
enableRowSelection: selectable || enableRowSelection || false,
|
|
@@ -74168,16 +74151,19 @@ function DataTable({
|
|
|
74168
74151
|
autoResetExpanded: false,
|
|
74169
74152
|
getRowId: (row, index2) => {
|
|
74170
74153
|
const rowData = row;
|
|
74171
|
-
|
|
74154
|
+
if (rowData.id)
|
|
74155
|
+
return String(rowData.id);
|
|
74156
|
+
if (rowData.orderId)
|
|
74157
|
+
return String(rowData.orderId);
|
|
74158
|
+
if (rowData.orderNumber)
|
|
74159
|
+
return String(rowData.orderNumber);
|
|
74160
|
+
if (rowData.email)
|
|
74161
|
+
return `email-${rowData.email}`;
|
|
74162
|
+
if (rowData.name)
|
|
74163
|
+
return `name-${rowData.name}-${index2}`;
|
|
74164
|
+
return String(index2);
|
|
74172
74165
|
}
|
|
74173
74166
|
});
|
|
74174
|
-
t__default.useEffect(() => {
|
|
74175
|
-
if (onRowSelect && selectable) {
|
|
74176
|
-
const selectedRowIds = Object.keys(rowSelection).filter((id) => rowSelection[id]);
|
|
74177
|
-
const selectedRows = table.getRowModel().rows.filter((row) => selectedRowIds.includes(row.id)).map((row) => row.original);
|
|
74178
|
-
onRowSelect(selectedRows);
|
|
74179
|
-
}
|
|
74180
|
-
}, [rowSelection, onRowSelect, selectable]);
|
|
74181
74167
|
table.getState();
|
|
74182
74168
|
const rowModel = table.getRowModel();
|
|
74183
74169
|
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.
|
|
3
|
+
"version": "2.26.47",
|
|
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,7 +81,7 @@
|
|
|
81
81
|
"react-dom": ">=18.0.0 || ^19.0.0"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@moontra/moonui-pro": "^2.26.
|
|
84
|
+
"@moontra/moonui-pro": "^2.26.46",
|
|
85
85
|
"@radix-ui/react-accordion": "^1.2.11",
|
|
86
86
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
87
87
|
"@radix-ui/react-checkbox": "^1.3.2",
|