@enos5/enos-vue-default 1.16.7 → 1.16.8
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/{code-BcyERX8s.js → code-Uq_sE9rw.js} +2 -2
- package/dist/{code-BcyERX8s.js.map → code-Uq_sE9rw.js.map} +1 -1
- package/dist/{default-BlbQaebe.js → default-BrvQoVVs.js} +2 -2
- package/dist/{default-BlbQaebe.js.map → default-BrvQoVVs.js.map} +1 -1
- package/dist/{dom-Dr7aAHqE.js → dom-CyNQy3FR.js} +2 -2
- package/dist/{dom-Dr7aAHqE.js.map → dom-CyNQy3FR.js.map} +1 -1
- package/dist/{image-BJntlUOW.js → image-BPy4dcSt.js} +2 -2
- package/dist/{image-BJntlUOW.js.map → image-BPy4dcSt.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.node.js +1 -1
- package/dist/{link-BqipZiMo.js → link-BNLldsh6.js} +2 -2
- package/dist/{link-BqipZiMo.js.map → link-BNLldsh6.js.map} +1 -1
- package/dist/{lists-B4tl_VfV.js → lists-CCw-difh.js} +2 -2
- package/dist/{lists-B4tl_VfV.js.map → lists-CCw-difh.js.map} +1 -1
- package/dist/{plugin-IFyVg9Jx.js → plugin-BXdUiTUI.js} +203 -157
- package/dist/{plugin-IFyVg9Jx.js.map → plugin-BXdUiTUI.js.map} +1 -1
- package/dist/{silver-B-eQlbVa.js → silver-6SQnxErw.js} +2 -2
- package/dist/{silver-B-eQlbVa.js.map → silver-6SQnxErw.js.map} +1 -1
- package/dist/styles.css +57 -6
- package/dist/{table-2QVKcjlJ.js → table-eUIcL87o.js} +2 -2
- package/dist/{table-2QVKcjlJ.js.map → table-eUIcL87o.js.map} +1 -1
- package/dist/{tinymce-Cux5-LNK.js → tinymce-_FcmnBzR.js} +2 -2
- package/dist/{tinymce-Cux5-LNK.js.map → tinymce-_FcmnBzR.js.map} +1 -1
- package/package.json +36 -36
|
@@ -2840,18 +2840,18 @@ var _sfc_main$18 = {
|
|
|
2840
2840
|
});
|
|
2841
2841
|
};
|
|
2842
2842
|
const loadTinyMce = async () => {
|
|
2843
|
-
const tinymceModule = await import("./tinymce-
|
|
2843
|
+
const tinymceModule = await import("./tinymce-_FcmnBzR.js").then((m) => /* @__PURE__ */ __toESM(m.default));
|
|
2844
2844
|
const tinymce = tinymceModule.default ?? tinymceModule;
|
|
2845
2845
|
if (typeof globalThis !== "undefined" && !globalThis.tinymce) globalThis.tinymce = tinymce;
|
|
2846
2846
|
await Promise.all([
|
|
2847
|
-
import("./dom-
|
|
2848
|
-
import("./default-
|
|
2849
|
-
import("./silver-
|
|
2850
|
-
import("./code-
|
|
2851
|
-
import("./image-
|
|
2852
|
-
import("./link-
|
|
2853
|
-
import("./lists-
|
|
2854
|
-
import("./table-
|
|
2847
|
+
import("./dom-CyNQy3FR.js"),
|
|
2848
|
+
import("./default-BrvQoVVs.js"),
|
|
2849
|
+
import("./silver-6SQnxErw.js"),
|
|
2850
|
+
import("./code-Uq_sE9rw.js"),
|
|
2851
|
+
import("./image-BPy4dcSt.js"),
|
|
2852
|
+
import("./link-BNLldsh6.js"),
|
|
2853
|
+
import("./lists-CCw-difh.js"),
|
|
2854
|
+
import("./table-eUIcL87o.js")
|
|
2855
2855
|
]);
|
|
2856
2856
|
isEditorReady.value = true;
|
|
2857
2857
|
};
|
|
@@ -2989,17 +2989,17 @@ var _hoisted_12$2 = {
|
|
|
2989
2989
|
class: "space-y-2"
|
|
2990
2990
|
};
|
|
2991
2991
|
var _hoisted_13$2 = ["for"];
|
|
2992
|
-
var _hoisted_14$
|
|
2992
|
+
var _hoisted_14$2 = [
|
|
2993
2993
|
"id",
|
|
2994
2994
|
"disabled",
|
|
2995
2995
|
"value"
|
|
2996
2996
|
];
|
|
2997
|
-
var _hoisted_15$
|
|
2997
|
+
var _hoisted_15$2 = {
|
|
2998
2998
|
key: 1,
|
|
2999
2999
|
class: "space-y-2"
|
|
3000
3000
|
};
|
|
3001
|
-
var _hoisted_16$
|
|
3002
|
-
var _hoisted_17 = [
|
|
3001
|
+
var _hoisted_16$2 = ["for"];
|
|
3002
|
+
var _hoisted_17$1 = [
|
|
3003
3003
|
"id",
|
|
3004
3004
|
"disabled",
|
|
3005
3005
|
"value"
|
|
@@ -3560,7 +3560,7 @@ var ColorPicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
3560
3560
|
value: hue.value,
|
|
3561
3561
|
style: { "background": "linear-gradient(90deg, #FF0000 0%, #FFFF00 17%, #00FF00 33%, #00FFFF 50%, #0000FF 67%, #FF00FF 83%, #FF0000 100%)" },
|
|
3562
3562
|
onInput: handleHueInput
|
|
3563
|
-
}, null, 42, _hoisted_14$
|
|
3563
|
+
}, null, 42, _hoisted_14$2)])) : createCommentVNode("", true), props.allowAlpha ? (openBlock(), createElementBlock("div", _hoisted_15$2, [createElementVNode("div", { class: normalizeClass(["flex items-center justify-between text-xs font-medium text-neutral-500 dark:text-neutral-400", props.ui.sectionLabel]) }, [createElementVNode("label", { for: fieldId.value ? `${fieldId.value}-alpha` : void 0 }, toDisplayString(unref(t)("Opacity")), 9, _hoisted_16$2), createElementVNode("span", null, toDisplayString(opacityPercent.value) + "%", 1)], 2), createElementVNode("input", {
|
|
3564
3564
|
id: fieldId.value ? `${fieldId.value}-alpha` : void 0,
|
|
3565
3565
|
type: "range",
|
|
3566
3566
|
min: "0",
|
|
@@ -3571,7 +3571,7 @@ var ColorPicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
|
|
|
3571
3571
|
value: opacityPercent.value,
|
|
3572
3572
|
style: normalizeStyle({ background: alphaGradient.value }),
|
|
3573
3573
|
onInput: handleAlphaInput
|
|
3574
|
-
}, null, 46, _hoisted_17)])) : createCommentVNode("", true)]),
|
|
3574
|
+
}, null, 46, _hoisted_17$1)])) : createCommentVNode("", true)]),
|
|
3575
3575
|
createElementVNode("div", _hoisted_18, [createElementVNode("label", {
|
|
3576
3576
|
for: fieldId.value ? `${fieldId.value}-hex` : void 0,
|
|
3577
3577
|
class: normalizeClass(["text-xs font-medium uppercase tracking-[0.16em] text-neutral-500 dark:text-neutral-400", props.ui.sectionLabel])
|
|
@@ -6242,35 +6242,38 @@ var _hoisted_2$2 = {
|
|
|
6242
6242
|
key: 0,
|
|
6243
6243
|
class: "w-10 px-2 py-3 text-center text-[11px] font-semibold uppercase tracking-[0.12em] text-neutral-600 dark:text-neutral-200"
|
|
6244
6244
|
};
|
|
6245
|
-
var _hoisted_3$2 =
|
|
6246
|
-
|
|
6247
|
-
"
|
|
6248
|
-
"
|
|
6249
|
-
|
|
6250
|
-
];
|
|
6251
|
-
var
|
|
6245
|
+
var _hoisted_3$2 = {
|
|
6246
|
+
key: 0,
|
|
6247
|
+
"data-table-list-placeholder": "",
|
|
6248
|
+
class: "bg-blue-50/60 dark:bg-blue-950/20"
|
|
6249
|
+
};
|
|
6250
|
+
var _hoisted_4$1 = ["colspan"];
|
|
6251
|
+
var _hoisted_5$1 = ["data-row-index"];
|
|
6252
|
+
var _hoisted_6$1 = {
|
|
6252
6253
|
key: 0,
|
|
6253
6254
|
class: "w-10 whitespace-nowrap px-2 py-4 text-center text-sm text-neutral-500 dark:text-neutral-400"
|
|
6254
6255
|
};
|
|
6255
|
-
var
|
|
6256
|
-
var
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
"onDragstart"
|
|
6260
|
-
];
|
|
6261
|
-
var _hoisted_7$1 = ["title"];
|
|
6262
|
-
var _hoisted_8$1 = {
|
|
6256
|
+
var _hoisted_7$1 = { class: "inline-flex items-center gap-1" };
|
|
6257
|
+
var _hoisted_8$1 = ["aria-label", "onPointerdown"];
|
|
6258
|
+
var _hoisted_9$1 = ["title"];
|
|
6259
|
+
var _hoisted_10$1 = {
|
|
6263
6260
|
key: 0,
|
|
6264
6261
|
class: "ml-2 inline-flex items-center rounded-full bg-red-100 px-2 py-1 text-xs font-medium text-red-700 dark:bg-red-950/60 dark:text-neutral-100"
|
|
6265
6262
|
};
|
|
6266
|
-
var
|
|
6267
|
-
var
|
|
6263
|
+
var _hoisted_11$1 = ["innerHTML"];
|
|
6264
|
+
var _hoisted_12$1 = {
|
|
6265
|
+
key: 0,
|
|
6266
|
+
"data-table-list-placeholder": "",
|
|
6267
|
+
class: "bg-blue-50/60 dark:bg-blue-950/20"
|
|
6268
|
+
};
|
|
6269
|
+
var _hoisted_13$1 = ["colspan"];
|
|
6270
|
+
var _hoisted_14$1 = {
|
|
6268
6271
|
key: 0,
|
|
6269
6272
|
class: "py-12 text-center"
|
|
6270
6273
|
};
|
|
6271
|
-
var
|
|
6272
|
-
var
|
|
6273
|
-
var
|
|
6274
|
+
var _hoisted_15$1 = { class: "mb-4 inline-flex h-16 w-16 items-center justify-center rounded-full bg-neutral-100 dark:bg-neutral-900" };
|
|
6275
|
+
var _hoisted_16$1 = { class: "mb-2 text-lg font-semibold text-neutral-950 dark:text-neutral-50" };
|
|
6276
|
+
var _hoisted_17 = { class: "mb-4 text-neutral-600 dark:text-neutral-200" };
|
|
6274
6277
|
var _sfc_main$1 = {
|
|
6275
6278
|
__name: "TableList",
|
|
6276
6279
|
props: {
|
|
@@ -6417,7 +6420,7 @@ var _sfc_main$1 = {
|
|
|
6417
6420
|
watch(() => props.data, (value) => {
|
|
6418
6421
|
localData.value = value;
|
|
6419
6422
|
});
|
|
6420
|
-
computed(() => !!slots.actions);
|
|
6423
|
+
const hasActionsSlot = computed(() => !!slots.actions);
|
|
6421
6424
|
const internalSearchQuery = ref("");
|
|
6422
6425
|
const searchQuery = computed({
|
|
6423
6426
|
get: () => props.searchValue ?? internalSearchQuery.value,
|
|
@@ -6443,80 +6446,30 @@ var _sfc_main$1 = {
|
|
|
6443
6446
|
return props.searchCount ?? filteredData.value.length;
|
|
6444
6447
|
});
|
|
6445
6448
|
const draggedIndex = ref(null);
|
|
6446
|
-
const
|
|
6449
|
+
const insertionIndex = ref(null);
|
|
6450
|
+
const isDragging = ref(false);
|
|
6447
6451
|
const dragPreview = ref(null);
|
|
6448
6452
|
const dragRowHeight = ref(0);
|
|
6449
6453
|
const tableRef = ref(null);
|
|
6454
|
+
const activePointerId = ref(null);
|
|
6455
|
+
const dragStartPosition = ref(null);
|
|
6456
|
+
const dragHandle = ref(null);
|
|
6457
|
+
const previousUserSelect = ref("");
|
|
6450
6458
|
const canReorder = computed(() => {
|
|
6451
6459
|
return props.orderable && !searchQuery.value.trim();
|
|
6452
6460
|
});
|
|
6453
|
-
const
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
dragOverIndex.value = index;
|
|
6460
|
-
const row = event.currentTarget?.closest("tr");
|
|
6461
|
-
if (row) {
|
|
6462
|
-
dragRowHeight.value = row.offsetHeight;
|
|
6463
|
-
const preview = document.createElement("div");
|
|
6464
|
-
const previewTable = document.createElement("table");
|
|
6465
|
-
const previewBody = document.createElement("tbody");
|
|
6466
|
-
const previewRow = row.cloneNode(true);
|
|
6467
|
-
previewTable.className = row.closest("table")?.className ?? "";
|
|
6468
|
-
previewTable.style.width = `${row.getBoundingClientRect().width}px`;
|
|
6469
|
-
previewTable.style.borderCollapse = "collapse";
|
|
6470
|
-
previewTable.style.background = "white";
|
|
6471
|
-
previewRow.classList.remove("opacity-0");
|
|
6472
|
-
previewRow.style.background = "white";
|
|
6473
|
-
previewRow.querySelectorAll("td").forEach((cell) => {
|
|
6474
|
-
cell.style.background = "white";
|
|
6475
|
-
});
|
|
6476
|
-
previewBody.appendChild(previewRow);
|
|
6477
|
-
previewTable.appendChild(previewBody);
|
|
6478
|
-
preview.appendChild(previewTable);
|
|
6479
|
-
dragPreview.value = preview;
|
|
6480
|
-
dragPreview.value.style.position = "fixed";
|
|
6481
|
-
dragPreview.value.style.top = "0";
|
|
6482
|
-
dragPreview.value.style.left = "0";
|
|
6483
|
-
dragPreview.value.style.background = "white";
|
|
6484
|
-
dragPreview.value.style.borderRadius = "0.5rem";
|
|
6485
|
-
dragPreview.value.style.boxShadow = "0 10px 25px rgb(15 23 42 / 0.18)";
|
|
6486
|
-
dragPreview.value.style.opacity = "0.96";
|
|
6487
|
-
dragPreview.value.style.pointerEvents = "none";
|
|
6488
|
-
dragPreview.value.style.zIndex = "1000";
|
|
6489
|
-
document.body.appendChild(dragPreview.value);
|
|
6490
|
-
updateDragPreviewPosition(event);
|
|
6491
|
-
document.addEventListener("dragover", handleDocumentDragOver, true);
|
|
6492
|
-
document.addEventListener("drop", handleDocumentDrop, true);
|
|
6493
|
-
const transparentDragImage = document.createElement("canvas");
|
|
6494
|
-
transparentDragImage.width = 1;
|
|
6495
|
-
transparentDragImage.height = 1;
|
|
6496
|
-
event.dataTransfer.setDragImage(transparentDragImage, 0, 0);
|
|
6497
|
-
}
|
|
6498
|
-
event.dataTransfer.effectAllowed = "move";
|
|
6499
|
-
event.dataTransfer.setData("text/plain", String(index));
|
|
6500
|
-
};
|
|
6501
|
-
const endDrag = () => {
|
|
6502
|
-
document.removeEventListener("dragover", handleDocumentDragOver, true);
|
|
6503
|
-
document.removeEventListener("drop", handleDocumentDrop, true);
|
|
6504
|
-
dragPreview.value?.remove();
|
|
6505
|
-
dragPreview.value = null;
|
|
6506
|
-
draggedIndex.value = null;
|
|
6507
|
-
dragOverIndex.value = null;
|
|
6508
|
-
dragRowHeight.value = 0;
|
|
6509
|
-
};
|
|
6510
|
-
const handleDocumentDragOver = (event) => {
|
|
6511
|
-
if (!canReorder.value || draggedIndex.value === null) return;
|
|
6512
|
-
event.preventDefault();
|
|
6513
|
-
updateDragPreviewPosition(event);
|
|
6461
|
+
const placeholderColumnCount = computed(() => {
|
|
6462
|
+
return props.columns.length + 1 + (hasActionsSlot.value ? 1 : 0);
|
|
6463
|
+
});
|
|
6464
|
+
const insertionPositionForRow = (index) => {
|
|
6465
|
+
if (draggedIndex.value === null || index < draggedIndex.value) return index;
|
|
6466
|
+
return index - 1;
|
|
6514
6467
|
};
|
|
6515
|
-
const
|
|
6516
|
-
|
|
6517
|
-
if (
|
|
6518
|
-
|
|
6519
|
-
|
|
6468
|
+
const isPointerWithinTable = (event) => {
|
|
6469
|
+
const table = tableRef.value;
|
|
6470
|
+
if (!table) return false;
|
|
6471
|
+
const rect = table.getBoundingClientRect();
|
|
6472
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
6520
6473
|
};
|
|
6521
6474
|
const updateDragPreviewPosition = (event) => {
|
|
6522
6475
|
if (!dragPreview.value) return;
|
|
@@ -6524,44 +6477,71 @@ var _sfc_main$1 = {
|
|
|
6524
6477
|
const offsetY = dragRowHeight.value / 2;
|
|
6525
6478
|
dragPreview.value.style.transform = `translate3d(${event.clientX - offsetX}px, ${event.clientY - offsetY}px, 0)`;
|
|
6526
6479
|
};
|
|
6527
|
-
const
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6480
|
+
const createDragPreview = (row) => {
|
|
6481
|
+
const preview = document.createElement("div");
|
|
6482
|
+
const previewTable = document.createElement("table");
|
|
6483
|
+
const previewBody = document.createElement("tbody");
|
|
6484
|
+
const previewRow = row.cloneNode(true);
|
|
6485
|
+
previewTable.className = row.closest("table")?.className ?? "";
|
|
6486
|
+
previewTable.style.width = `${row.getBoundingClientRect().width}px`;
|
|
6487
|
+
previewTable.style.borderCollapse = "collapse";
|
|
6488
|
+
previewTable.style.background = "white";
|
|
6489
|
+
previewRow.style.background = "white";
|
|
6490
|
+
previewRow.querySelectorAll("td").forEach((cell) => {
|
|
6491
|
+
cell.style.background = "white";
|
|
6492
|
+
});
|
|
6493
|
+
previewBody.appendChild(previewRow);
|
|
6494
|
+
previewTable.appendChild(previewBody);
|
|
6495
|
+
preview.appendChild(previewTable);
|
|
6496
|
+
preview.style.position = "fixed";
|
|
6497
|
+
preview.style.top = "0";
|
|
6498
|
+
preview.style.left = "0";
|
|
6499
|
+
preview.style.background = "white";
|
|
6500
|
+
preview.style.borderRadius = "0.5rem";
|
|
6501
|
+
preview.style.boxShadow = "0 10px 25px rgb(15 23 42 / 0.18)";
|
|
6502
|
+
preview.style.opacity = "0.96";
|
|
6503
|
+
preview.style.pointerEvents = "none";
|
|
6504
|
+
preview.style.zIndex = "1000";
|
|
6505
|
+
document.body.appendChild(preview);
|
|
6506
|
+
dragPreview.value = preview;
|
|
6507
|
+
};
|
|
6508
|
+
const updateInsertionIndex = (event) => {
|
|
6509
|
+
if (!isDragging.value || !isPointerWithinTable(event)) return;
|
|
6510
|
+
const placeholder = tableRef.value?.querySelector("[data-table-list-placeholder]");
|
|
6511
|
+
if (placeholder) {
|
|
6512
|
+
const placeholderRect = placeholder.getBoundingClientRect();
|
|
6513
|
+
if (event.clientY >= placeholderRect.top && event.clientY <= placeholderRect.bottom) return;
|
|
6531
6514
|
}
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
const targetRow = Array.from(tbody.children).find((candidate) => {
|
|
6537
|
-
const rect = candidate.getBoundingClientRect();
|
|
6538
|
-
return event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
6515
|
+
const rows = Array.from(tableRef.value?.querySelectorAll("tbody tr[data-row-index]") ?? []);
|
|
6516
|
+
const nextInsertionIndex = rows.findIndex((row) => {
|
|
6517
|
+
const rect = row.getBoundingClientRect();
|
|
6518
|
+
return event.clientY < rect.top + rect.height / 2;
|
|
6539
6519
|
});
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6520
|
+
insertionIndex.value = nextInsertionIndex === -1 ? rows.length : nextInsertionIndex;
|
|
6521
|
+
};
|
|
6522
|
+
const cleanupPointerDrag = () => {
|
|
6523
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
6524
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
6525
|
+
document.removeEventListener("pointercancel", handlePointerCancel);
|
|
6526
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
6527
|
+
if (dragHandle.value?.hasPointerCapture?.(activePointerId.value)) dragHandle.value.releasePointerCapture(activePointerId.value);
|
|
6528
|
+
document.body.style.userSelect = previousUserSelect.value;
|
|
6529
|
+
dragPreview.value?.remove();
|
|
6530
|
+
dragPreview.value = null;
|
|
6531
|
+
draggedIndex.value = null;
|
|
6532
|
+
insertionIndex.value = null;
|
|
6533
|
+
isDragging.value = false;
|
|
6534
|
+
dragRowHeight.value = 0;
|
|
6535
|
+
activePointerId.value = null;
|
|
6536
|
+
dragStartPosition.value = null;
|
|
6537
|
+
dragHandle.value = null;
|
|
6549
6538
|
};
|
|
6550
|
-
const
|
|
6551
|
-
|
|
6552
|
-
if (!canReorder.value || draggedIndex.value === null) {
|
|
6553
|
-
endDrag();
|
|
6554
|
-
return;
|
|
6555
|
-
}
|
|
6556
|
-
const targetIndex = getDropTargetIndex(event, dragOverIndex.value ?? toIndex);
|
|
6557
|
-
if (draggedIndex.value === targetIndex) {
|
|
6558
|
-
endDrag();
|
|
6559
|
-
return;
|
|
6560
|
-
}
|
|
6539
|
+
const commitReorder = () => {
|
|
6540
|
+
if (draggedIndex.value === null || insertionIndex.value === null || draggedIndex.value === insertionIndex.value) return;
|
|
6561
6541
|
const result = reorderRows({
|
|
6562
6542
|
data: localData.value,
|
|
6563
6543
|
fromIndex: draggedIndex.value,
|
|
6564
|
-
toIndex:
|
|
6544
|
+
toIndex: insertionIndex.value,
|
|
6565
6545
|
orderField: props.orderField,
|
|
6566
6546
|
mutateRows: props.mutateRows
|
|
6567
6547
|
});
|
|
@@ -6571,10 +6551,69 @@ var _sfc_main$1 = {
|
|
|
6571
6551
|
} else localData.value = result.data;
|
|
6572
6552
|
emit("reorder", {
|
|
6573
6553
|
...result,
|
|
6574
|
-
rowKey: getRowKey(result.item,
|
|
6554
|
+
rowKey: getRowKey(result.item, insertionIndex.value, props.rowKey)
|
|
6575
6555
|
});
|
|
6576
|
-
endDrag();
|
|
6577
6556
|
};
|
|
6557
|
+
const startPointerDrag = (index, event) => {
|
|
6558
|
+
if (!canReorder.value || event.pointerType === "mouse" && event.button !== 0) return;
|
|
6559
|
+
const row = event.currentTarget?.closest("tr");
|
|
6560
|
+
if (!row) return;
|
|
6561
|
+
event.preventDefault();
|
|
6562
|
+
event.stopPropagation();
|
|
6563
|
+
draggedIndex.value = index;
|
|
6564
|
+
insertionIndex.value = index;
|
|
6565
|
+
activePointerId.value = event.pointerId;
|
|
6566
|
+
dragStartPosition.value = {
|
|
6567
|
+
x: event.clientX,
|
|
6568
|
+
y: event.clientY
|
|
6569
|
+
};
|
|
6570
|
+
dragHandle.value = event.currentTarget;
|
|
6571
|
+
dragRowHeight.value = row.getBoundingClientRect().height;
|
|
6572
|
+
previousUserSelect.value = document.body.style.userSelect;
|
|
6573
|
+
dragHandle.value.setPointerCapture?.(event.pointerId);
|
|
6574
|
+
document.addEventListener("pointermove", handlePointerMove);
|
|
6575
|
+
document.addEventListener("pointerup", handlePointerUp);
|
|
6576
|
+
document.addEventListener("pointercancel", handlePointerCancel);
|
|
6577
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
6578
|
+
};
|
|
6579
|
+
const handlePointerMove = (event) => {
|
|
6580
|
+
if (event.pointerId !== activePointerId.value) return;
|
|
6581
|
+
if (!isDragging.value) {
|
|
6582
|
+
const distanceX = event.clientX - dragStartPosition.value.x;
|
|
6583
|
+
const distanceY = event.clientY - dragStartPosition.value.y;
|
|
6584
|
+
if (Math.hypot(distanceX, distanceY) < 5) return;
|
|
6585
|
+
const row = dragHandle.value?.closest("tr");
|
|
6586
|
+
if (!row) {
|
|
6587
|
+
cleanupPointerDrag();
|
|
6588
|
+
return;
|
|
6589
|
+
}
|
|
6590
|
+
document.body.style.userSelect = "none";
|
|
6591
|
+
createDragPreview(row);
|
|
6592
|
+
isDragging.value = true;
|
|
6593
|
+
updateDragPreviewPosition(event);
|
|
6594
|
+
event.preventDefault();
|
|
6595
|
+
nextTick(() => updateInsertionIndex(event));
|
|
6596
|
+
return;
|
|
6597
|
+
}
|
|
6598
|
+
event.preventDefault();
|
|
6599
|
+
updateDragPreviewPosition(event);
|
|
6600
|
+
updateInsertionIndex(event);
|
|
6601
|
+
};
|
|
6602
|
+
const handlePointerUp = (event) => {
|
|
6603
|
+
if (event.pointerId !== activePointerId.value) return;
|
|
6604
|
+
if (isDragging.value && isPointerWithinTable(event)) {
|
|
6605
|
+
updateInsertionIndex(event);
|
|
6606
|
+
commitReorder();
|
|
6607
|
+
}
|
|
6608
|
+
cleanupPointerDrag();
|
|
6609
|
+
};
|
|
6610
|
+
const handlePointerCancel = (event) => {
|
|
6611
|
+
if (event.pointerId === activePointerId.value) cleanupPointerDrag();
|
|
6612
|
+
};
|
|
6613
|
+
const handleKeyDown = (event) => {
|
|
6614
|
+
if (event.key === "Escape") cleanupPointerDrag();
|
|
6615
|
+
};
|
|
6616
|
+
onBeforeUnmount(cleanupPointerDrag);
|
|
6578
6617
|
const sortBy = (field) => {
|
|
6579
6618
|
emit("sort", field);
|
|
6580
6619
|
};
|
|
@@ -6693,22 +6732,23 @@ var _sfc_main$1 = {
|
|
|
6693
6732
|
class: normalizeClass(actionHeaderClass.value)
|
|
6694
6733
|
}, toDisplayString(__props.actionsLabel), 3)) : createCommentVNode("", true)
|
|
6695
6734
|
], 2)], 2), createElementVNode("tbody", { class: normalizeClass(joinClasses("divide-y divide-neutral-200 bg-white dark:divide-neutral-800 dark:bg-neutral-950", __props.tbodyClass)) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(filteredData.value, (item, index) => {
|
|
6696
|
-
return openBlock(), createElementBlock("tr", {
|
|
6697
|
-
|
|
6735
|
+
return openBlock(), createElementBlock(Fragment, { key: unref(getRowKey)(item, index, __props.rowKey) }, [isDragging.value && index !== draggedIndex.value && insertionIndex.value === insertionPositionForRow(index) ? (openBlock(), createElementBlock("tr", _hoisted_3$2, [createElementVNode("td", {
|
|
6736
|
+
colspan: placeholderColumnCount.value,
|
|
6737
|
+
class: "p-0"
|
|
6738
|
+
}, [createElementVNode("div", {
|
|
6739
|
+
class: "mx-2 rounded-md border border-dashed border-blue-400 bg-blue-50/70 dark:border-blue-500 dark:bg-blue-950/30",
|
|
6740
|
+
style: normalizeStyle({ height: `${dragRowHeight.value}px` })
|
|
6741
|
+
}, null, 4)], 8, _hoisted_4$1)])) : createCommentVNode("", true), !isDragging.value || index !== draggedIndex.value ? (openBlock(), createElementBlock("tr", {
|
|
6742
|
+
key: 1,
|
|
6698
6743
|
"data-row-index": index,
|
|
6699
|
-
class: normalizeClass(joinClasses(__props.rowClasses(item, index), "transition-
|
|
6700
|
-
style: normalizeStyle(rowDragStyle(index)),
|
|
6701
|
-
onDragenter: ($event) => updateDragOver(index, $event),
|
|
6702
|
-
onDragover: withModifiers(($event) => updateDragOver(index, $event), ["prevent"]),
|
|
6703
|
-
onDrop: ($event) => dropRow(index, $event)
|
|
6744
|
+
class: normalizeClass(joinClasses(__props.rowClasses(item, index), "transition-transform duration-150 ease-out"))
|
|
6704
6745
|
}, [
|
|
6705
|
-
__props.orderable ? (openBlock(), createElementBlock("td",
|
|
6706
|
-
draggable: canReorder.value,
|
|
6746
|
+
__props.orderable ? (openBlock(), createElementBlock("td", _hoisted_6$1, [createElementVNode("span", _hoisted_7$1, [createElementVNode("span", {
|
|
6707
6747
|
class: "cursor-grab touch-none active:cursor-grabbing",
|
|
6708
6748
|
"aria-label": `Drag row ${index + 1}`,
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
}, [createVNode(unref(GripVertical), { class: "size-4" })], 40,
|
|
6749
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
|
|
6750
|
+
onPointerdown: ($event) => startPointerDrag(index, $event)
|
|
6751
|
+
}, [createVNode(unref(GripVertical), { class: "size-4" })], 40, _hoisted_8$1), createElementVNode("span", null, toDisplayString(index + 1), 1)])])) : createCommentVNode("", true),
|
|
6712
6752
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
|
|
6713
6753
|
return openBlock(), createElementBlock("td", {
|
|
6714
6754
|
key: column.key,
|
|
@@ -6720,7 +6760,7 @@ var _sfc_main$1 = {
|
|
|
6720
6760
|
}, [createElementVNode("div", {
|
|
6721
6761
|
class: "truncate text-sm font-medium text-neutral-950 dark:text-neutral-50",
|
|
6722
6762
|
title: getCellContent(item, column)
|
|
6723
|
-
}, toDisplayString(getCellContent(item, column)), 9,
|
|
6763
|
+
}, toDisplayString(getCellContent(item, column)), 9, _hoisted_9$1), isDeleted(item) ? (openBlock(), createElementBlock("span", _hoisted_10$1, toDisplayString(__props.deletedLabel), 1)) : createCommentVNode("", true)], 2)) : column.slot ? (openBlock(), createElementBlock("div", {
|
|
6724
6764
|
key: 1,
|
|
6725
6765
|
class: normalizeClass(getContentClass(column))
|
|
6726
6766
|
}, [renderSlot(_ctx.$slots, column.slot, {
|
|
@@ -6731,7 +6771,7 @@ var _sfc_main$1 = {
|
|
|
6731
6771
|
key: 2,
|
|
6732
6772
|
class: normalizeClass(getContentClass(column)),
|
|
6733
6773
|
innerHTML: column.render(item)
|
|
6734
|
-
}, null, 10,
|
|
6774
|
+
}, null, 10, _hoisted_11$1)) : (openBlock(), createElementBlock("div", {
|
|
6735
6775
|
key: 3,
|
|
6736
6776
|
class: normalizeClass(getContentClass(column))
|
|
6737
6777
|
}, toDisplayString(getCellContent(item, column)), 3))], 6);
|
|
@@ -6743,11 +6783,17 @@ var _sfc_main$1 = {
|
|
|
6743
6783
|
item,
|
|
6744
6784
|
index
|
|
6745
6785
|
})], 2)) : createCommentVNode("", true)
|
|
6746
|
-
],
|
|
6747
|
-
}), 128))
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6786
|
+
], 10, _hoisted_5$1)) : createCommentVNode("", true)], 64);
|
|
6787
|
+
}), 128)), isDragging.value && insertionIndex.value === filteredData.value.length - 1 ? (openBlock(), createElementBlock("tr", _hoisted_12$1, [createElementVNode("td", {
|
|
6788
|
+
colspan: placeholderColumnCount.value,
|
|
6789
|
+
class: "p-0"
|
|
6790
|
+
}, [createElementVNode("div", {
|
|
6791
|
+
class: "mx-2 rounded-md border border-dashed border-blue-400 bg-blue-50/70 dark:border-blue-500 dark:bg-blue-950/30",
|
|
6792
|
+
style: normalizeStyle({ height: `${dragRowHeight.value}px` })
|
|
6793
|
+
}, null, 4)], 8, _hoisted_13$1)])) : createCommentVNode("", true)], 2)], 2)], 2), !hasData.value ? (openBlock(), createElementBlock("div", _hoisted_14$1, [
|
|
6794
|
+
createElementVNode("div", _hoisted_15$1, [(openBlock(), createBlock(resolveDynamicComponent(__props.emptyState.icon), { class: "h-8 w-8 text-neutral-400 dark:text-neutral-200" }))]),
|
|
6795
|
+
createElementVNode("h3", _hoisted_16$1, toDisplayString(__props.emptyState.title), 1),
|
|
6796
|
+
createElementVNode("p", _hoisted_17, toDisplayString(__props.emptyState.description), 1),
|
|
6751
6797
|
__props.emptyState.actionText && __props.emptyState.actionUrl ? (openBlock(), createBlock(_sfc_main$6, {
|
|
6752
6798
|
key: 0,
|
|
6753
6799
|
href: __props.emptyState.actionUrl,
|
|
@@ -7576,4 +7622,4 @@ var plugin_default = { install(app) {
|
|
|
7576
7622
|
//#endregion
|
|
7577
7623
|
export { _sfc_main$34 as $, _sfc_main$11 as A, _sfc_main$21 as B, useSidebar as C, _sfc_main$8 as D, _sfc_main$7 as E, _sfc_main$16 as F, _sfc_main$26 as G, _sfc_main$23 as H, ColorPicker_default as I, _sfc_main$29 as J, _sfc_main$27 as K, _sfc_main$18 as L, _sfc_main$13 as M, _sfc_main$14 as N, _sfc_main$9 as O, _sfc_main$15 as P, _sfc_main$33 as Q, _sfc_main$19 as R, Sidebar_default as S, _sfc_main$6 as T, DateRangeInput_default as U, _sfc_main$22 as V, DateInput_default as W, _sfc_main$31 as X, _sfc_main$30 as Y, _sfc_main$32 as Z, SidebarGroupLabel_default as _, _sfc_main$1 as a, _sfc_main$40 as at, SidebarFooter_default as b, _sfc_main$4 as c, SidebarProvider_default as d, SectionTitle_default as et, SidebarMenuItem_default as f, SidebarHeader_default as g, SidebarInset_default as h, _sfc_main as i, _sfc_main$39 as it, _sfc_main$12 as j, _sfc_main$10 as k, SlidePanel_default as l, SidebarMenu_default as m, ToastContainer_default as n, _sfc_main$37 as nt, _sfc_main$2 as o, __commonJSMin as ot, SidebarMenuButton_default as p, _sfc_main$28 as q, Toast_default as r, _sfc_main$38 as rt, _sfc_main$3 as s, plugin_default as t, _sfc_main$36 as tt, SidebarTrigger_default as u, SidebarGroupContent_default as v, _sfc_main$5 as w, SidebarContent_default as x, SidebarGroup_default as y, _sfc_main$20 as z };
|
|
7578
7624
|
|
|
7579
|
-
//# sourceMappingURL=plugin-
|
|
7625
|
+
//# sourceMappingURL=plugin-BXdUiTUI.js.map
|