false,
+ },
},
emits: [
"update:selection",
@@ -249,6 +257,22 @@ export default {
{ immediate: true }
);
+ const onDrop = (data, event) => {
+ if (props.canDragOverRow(data)) {
+ emit("row-drop", { data, event });
+ }
+ };
+ const dragOveredRowKey = ref(null);
+ const onDragover = (key, data, event) => {
+ if (props.canDragOverRow(data)) {
+ event.preventDefault();
+ dragOveredRowKey.value = key;
+ }
+ };
+ const onDragleave = () => {
+ dragOveredRowKey.value = null;
+ };
+
return {
// References
computedRows,
@@ -257,7 +281,11 @@ export default {
pageIndexEnd,
pageIndexStart,
rowSelection,
+ dragOveredRowKey,
// Methods
+ onDrop,
+ onDragover,
+ onDragleave,
toggleAll,
toggleRow,
};
diff --git a/src/web/views/Components/Table/props-data.js b/src/web/views/Components/Table/props-data.js
index 8cd555f5..9e250f4a 100644
--- a/src/web/views/Components/Table/props-data.js
+++ b/src/web/views/Components/Table/props-data.js
@@ -96,4 +96,12 @@ export default [
"Use this prop to set table-layout css property (e.g. 'auto' or 'fixed').",
"",
],
+ [
+ "canDragOverRow",
+ "Function",
+ "",
+ "row => false",
+ "If returns true, a 'bimdata-table__row--drag-overed' class is added on the row on drag over, and the `row-drop` event is emitted on drop.",
+ "",
+ ],
];
|