@oliasoft-open-source/react-ui-library 4.19.2-beta-3 → 4.19.3-beta-1
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/README.md +1 -0
- package/dist/index.js +10 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1989,6 +1989,7 @@ The `Table` component renders tabular data with various customization options.
|
|
|
1989
1989
|
| Prop | Description | Default Value |
|
|
1990
1990
|
|-----------------------|--------------------------------------------------------------------------------------------------|---------------|
|
|
1991
1991
|
| `onListReorder` | Function called when rows are reordered. | `() => {}` |
|
|
1992
|
+
| `canListReorder` | Function to compare `from` and `to` to determine if reordering is allowed. | `() => true` |
|
|
1992
1993
|
| `table` | An object containing table configuration. | |
|
|
1993
1994
|
| `table.name` | Name or title of the table. | |
|
|
1994
1995
|
| `table.actionsRight` | Determines if actions should be displayed on the right side of the table. | `false` |
|
package/dist/index.js
CHANGED
|
@@ -13873,9 +13873,6 @@ const ListDragWrapper = ({
|
|
|
13873
13873
|
onListReorder
|
|
13874
13874
|
}) => {
|
|
13875
13875
|
const [dragIndex, setDragIndex] = useState(null);
|
|
13876
|
-
if (!draggable) {
|
|
13877
|
-
return children;
|
|
13878
|
-
}
|
|
13879
13876
|
const handleDragStart2 = (event) => {
|
|
13880
13877
|
setDragIndex(event.active.id);
|
|
13881
13878
|
};
|
|
@@ -13895,6 +13892,9 @@ const ListDragWrapper = ({
|
|
|
13895
13892
|
() => list2.items.map((_2, index2) => index2.toString()),
|
|
13896
13893
|
[list2.items]
|
|
13897
13894
|
);
|
|
13895
|
+
if (!draggable) {
|
|
13896
|
+
return children;
|
|
13897
|
+
}
|
|
13898
13898
|
return /* @__PURE__ */ jsxs(
|
|
13899
13899
|
DndContext$1,
|
|
13900
13900
|
{
|
|
@@ -52141,7 +52141,6 @@ const TableDragWrapper = (props) => {
|
|
|
52141
52141
|
tbodyRef
|
|
52142
52142
|
} = props;
|
|
52143
52143
|
const [dragIndex, setDragIndex] = useState(null);
|
|
52144
|
-
const [canDragToIndexes, setCanDragToIndexes] = useState([]);
|
|
52145
52144
|
const [dropDisabled, setDropDisabled] = useState(false);
|
|
52146
52145
|
const itemIds = useMemo(
|
|
52147
52146
|
() => rows.map((_2, index2) => index2.toString()),
|
|
@@ -52149,29 +52148,22 @@ const TableDragWrapper = (props) => {
|
|
|
52149
52148
|
);
|
|
52150
52149
|
const handleDragStart2 = (event) => {
|
|
52151
52150
|
setDragIndex(event.active.id);
|
|
52152
|
-
const enabledIndexes = rows.map((_2, index2) => index2).filter((index2) => {
|
|
52153
|
-
if (rows[index2].noDrag) return false;
|
|
52154
|
-
if (canListReorder({ from: Number(event.active.id), to: index2 }))
|
|
52155
|
-
return true;
|
|
52156
|
-
return false;
|
|
52157
|
-
});
|
|
52158
|
-
setCanDragToIndexes(enabledIndexes);
|
|
52159
52151
|
};
|
|
52160
52152
|
const handleDragEnd = (event) => {
|
|
52161
52153
|
setDragIndex(null);
|
|
52162
52154
|
setDropDisabled(false);
|
|
52163
|
-
setCanDragToIndexes([]);
|
|
52164
52155
|
const { active: active2, over } = event;
|
|
52165
52156
|
if (!active2 || !over || active2.id === over.id) return;
|
|
52166
|
-
|
|
52167
|
-
|
|
52168
|
-
|
|
52169
|
-
|
|
52170
|
-
});
|
|
52157
|
+
const from3 = Number(active2.id);
|
|
52158
|
+
const to2 = Number(over == null ? void 0 : over.id);
|
|
52159
|
+
if (!canListReorder({ from: from3, to: to2 })) return;
|
|
52160
|
+
onListReorder({ from: from3, to: to2 });
|
|
52171
52161
|
};
|
|
52172
52162
|
const handleDragOver = (event) => {
|
|
52173
52163
|
const { active: active2, over } = event;
|
|
52174
|
-
const
|
|
52164
|
+
const from3 = Number(active2.id);
|
|
52165
|
+
const to2 = Number(over == null ? void 0 : over.id);
|
|
52166
|
+
const disabled2 = from3 !== to2 && !canListReorder({ from: from3, to: to2 });
|
|
52175
52167
|
setDropDisabled(disabled2);
|
|
52176
52168
|
};
|
|
52177
52169
|
const getCalculatedWidths = () => {
|