An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Support drag selection in database kanban views https://github.com/siyuan-note/siyuan/issues/14978
Daniel978806609db0
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scssindex 3b1de942a9..26f6b97e80 100644--- a/app/src/assets/scss/business/_av.scss+++ b/app/src/assets/scss/business/_av.scss@@ -201,10 +201,23 @@font-size: 87.5%;}- &__title.fn__none + .av__counter:not(.fn__none) {- position: static;+ &__header:has(> .av__title.fn__none + .av__counter:not(.fn__none)) {display: flex;align-items: center;++ .av__views {+ min-width: 0;+ flex: 1;+ order: 2;+ }++ .av__counter {+ position: static;+ display: flex;+ align-items: center;+ flex-shrink: 0;+ order: 1;+ }}&__mask {diff --git a/app/src/protyle/render/av/dragSelect.ts b/app/src/protyle/render/av/dragSelect.tsindex 966ad4d4bc..a6aa77ccef 100644--- a/app/src/protyle/render/av/dragSelect.ts+++ b/app/src/protyle/render/av/dragSelect.ts@@ -2,21 +2,27 @@ import {resetAVRowSelect} from "./virtualScroll";import {updateAVSelectionStatus} from "./row";import {hasClosestByClassName} from "../../util/hasClosest";-const isRectIntersecting = (rect: DOMRect, selectRect: DOMRect) => {- return rect.height > 0 && rect.width > 0 &&- rect.top < selectRect.bottom && rect.bottom > selectRect.top &&- rect.left < selectRect.right && rect.right > selectRect.left;+const isRectIntersecting = (rect: DOMRect, selectRect: DOMRect, clipRect?: DOMRect) => {+ const top = Math.max(rect.top, clipRect?.top ?? rect.top);+ const right = Math.min(rect.right, clipRect?.right ?? rect.right);+ const bottom = Math.min(rect.bottom, clipRect?.bottom ?? rect.bottom);+ const left = Math.max(rect.left, clipRect?.left ?? rect.left);+ return top < bottom && left < right &&+ top < selectRect.bottom && bottom > selectRect.top &&+ left < selectRect.right && right > selectRect.left;};export const isAVDragSelectSupported = (blockElement: HTMLElement) => {return blockElement.classList.contains("av") &&- ["table", "gallery"].includes(blockElement.dataset.avType);+ ["table", "kanban", "gallery"].includes(blockElement.dataset.avType);};export const applyAVDragSelection = (blockElement: HTMLElement, selectRect: DOMRect) => {const isTable = blockElement.dataset.avType === "table";const itemSelector = isTable ? ".av__row[data-id]" :".av__gallery-item[data-id]:not([data-type=\"ghost\"])";+ const clipRect = blockElement.dataset.avType === "kanban" ?+ blockElement.querySelector(":scope > .av__container > .av__kanban")?.getBoundingClientRect() : undefined;const selectedIdsByBody = new Map<HTMLElement, Set<string>>();blockElement.querySelectorAll(".av__body").forEach((bodyElement: HTMLElement) => {if (hasClosestByClassName(bodyElement, "av") !== blockElement) {@@ -30,7 +36,7 @@ export const applyAVDragSelection = (blockElement: HTMLElement, selectRect: DOMRreturn;}const bodyElement = hasClosestByClassName(item, "av__body") as HTMLElement;- const selected = isRectIntersecting(item.getBoundingClientRect(), selectRect);+ const selected = isRectIntersecting(item.getBoundingClientRect(), selectRect, clipRect);if (isTable) {item.classList.toggle("av__row--select", selected);item.querySelector(".av__firstcol use")?.setAttribute("xlink:href", selected ? "#iconCheck" : "#iconUncheck");