@moontra/moonui-pro 2.26.39 → 2.26.40
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 +47 -47
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +20 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -74001,14 +74001,21 @@ function DataTable({
|
|
|
74001
74001
|
const checkboxColumn = {
|
|
74002
74002
|
id: "select",
|
|
74003
74003
|
header: ({ table: table2 }) => {
|
|
74004
|
-
const
|
|
74005
|
-
const
|
|
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]);
|
|
74006
74007
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
74007
74008
|
MoonUICheckboxPro,
|
|
74008
74009
|
{
|
|
74009
74010
|
checked: isAllSelected ? true : isSomeSelected ? "indeterminate" : false,
|
|
74010
74011
|
onCheckedChange: (value) => {
|
|
74011
|
-
|
|
74012
|
+
const newSelection = {};
|
|
74013
|
+
if (value) {
|
|
74014
|
+
allRowIds.forEach((id) => {
|
|
74015
|
+
newSelection[id] = true;
|
|
74016
|
+
});
|
|
74017
|
+
}
|
|
74018
|
+
setRowSelection(newSelection);
|
|
74012
74019
|
},
|
|
74013
74020
|
"aria-label": "Select all",
|
|
74014
74021
|
className: "h-4 w-4"
|
|
@@ -74016,14 +74023,18 @@ function DataTable({
|
|
|
74016
74023
|
) });
|
|
74017
74024
|
},
|
|
74018
74025
|
cell: ({ row }) => {
|
|
74026
|
+
const rowId = row.id;
|
|
74027
|
+
const isSelected = !!rowSelection[rowId];
|
|
74019
74028
|
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
74020
74029
|
MoonUICheckboxPro,
|
|
74021
74030
|
{
|
|
74022
|
-
checked:
|
|
74031
|
+
checked: isSelected,
|
|
74023
74032
|
onCheckedChange: (value) => {
|
|
74024
|
-
|
|
74033
|
+
setRowSelection((prev) => ({
|
|
74034
|
+
...prev,
|
|
74035
|
+
[rowId]: !!value
|
|
74036
|
+
}));
|
|
74025
74037
|
},
|
|
74026
|
-
disabled: !row.getCanSelect(),
|
|
74027
74038
|
"aria-label": "Select row",
|
|
74028
74039
|
className: "h-4 w-4"
|
|
74029
74040
|
}
|
|
@@ -74154,10 +74165,11 @@ function DataTable({
|
|
|
74154
74165
|
});
|
|
74155
74166
|
t__default.useEffect(() => {
|
|
74156
74167
|
if (onRowSelect && selectable) {
|
|
74157
|
-
const
|
|
74168
|
+
const selectedRowIds = Object.keys(rowSelection).filter((id) => rowSelection[id]);
|
|
74169
|
+
const selectedRows = table.getRowModel().rows.filter((row) => selectedRowIds.includes(row.id)).map((row) => row.original);
|
|
74158
74170
|
onRowSelect(selectedRows);
|
|
74159
74171
|
}
|
|
74160
|
-
}, [rowSelection]);
|
|
74172
|
+
}, [rowSelection, onRowSelect, selectable]);
|
|
74161
74173
|
table.getState();
|
|
74162
74174
|
const rowModel = table.getRowModel();
|
|
74163
74175
|
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.40",
|
|
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",
|