An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Support database filter composition https://github.com/siyuan-note/siyuan/issues/10550
Danielcd8ca7e9f10a
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scssindex 2644ed5094..7e11ca5962 100644--- a/app/src/assets/scss/business/_av.scss+++ b/app/src/assets/scss/business/_av.scss@@ -1024,6 +1024,95 @@background-color: transparent !important;color: var(--b3-theme-on-surface) !important;}++ .av__filter-select {+ margin: 0;+ flex-shrink: 0;+ min-width: 60px;+ height: 28px;+ line-height: 20px;+ font-size: 14px;+ box-shadow: none;+ padding-left: 6px;+ padding-right: 20px;+ background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10"><path fill="%23888" d="M2 4l3 3 3-3z"/></svg>') no-repeat right 6px center;+ }++ .av__filter-input {+ margin: 0;+ box-shadow: none;+ background: transparent;+ flex: 1;+ min-width: 60px;+ height: 28px;+ font-size: 14px;+ }++ .av__filter-value {+ display: inline-flex;+ align-items: center;+ flex: 1;+ min-width: 60px;+ }++ .av__select-trigger {+ display: inline-flex;+ align-items: center;+ flex: 1;+ min-width: 60px;+ cursor: pointer;+ overflow: hidden;+ padding-right: 20px;+ background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10"><path fill="%23888" d="M2 4l3 3 3-3z"/></svg>') no-repeat right 6px center;+ }++ .av__select-dropdown {+ position: fixed;+ z-index: 9999;+ width: fit-content;+ min-width: 120px;+ max-height: 240px;+ overflow-x: hidden;+ overflow-y: auto;+ padding: 4px;+ box-shadow: var(--b3-dialog-shadow);+ border-radius: var(--b3-border-radius);+ background-color: var(--b3-menu-background);+ }++ .av__select-options {+ display: flex;+ flex-direction: column;+ width: 100%;+ overflow: hidden;+ }++ .av__filter-date-row {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ flex-wrap: wrap;+ }++ .av__filter-date-col {+ display: inline-flex;+ flex-direction: column;+ gap: 6px;+ }++ &.av__filter-panel {+ min-width: 340px;+ max-width: 80vw;+ width: fit-content;+ }++ .b3-menu__action[data-type="removeFilter"]:hover {+ color: var(--b3-theme-error);+ }++ .av__filter-group-header:hover .av__group-actions {+ opacity: 1;+ }}}diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex 909fcf776f..10e72363ae 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -868,6 +868,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemenoperator: getDefaultOperatorByType(type),value: genCellValue(type, ""),};+ const oldFilters = JSON.parse(JSON.stringify(avData.view.filters));getEditableFilters(avData).push(filter);transaction(protyle, [{action: "setAttrViewFilters",@@ -877,7 +878,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen}], [{action: "setAttrViewFilters",avID,- data: [], // undo 时移除新增条件(简化处理)+ data: oldFilters,blockID: blockElement.getAttribute("data-node-id")}]);}diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.tsindex 43c2bf72fa..afdc8735e8 100644--- a/app/src/protyle/render/av/filter.ts+++ b/app/src/protyle/render/av/filter.ts@@ -220,7 +220,7 @@ export const getFiltersHTML = (data: IAV) => {document.body.removeChild(measureEl);const andOrControlWidth = andOrTextWidth + 28;const genAndOrSelect = (groupPath: string, combination: string) =>- `<select class="b3-select" data-type="toggleCombination" data-path="${groupPath}" style="margin:0;flex-shrink:0;width:${andOrControlWidth}px;box-sizing:border-box;height:28px;line-height:20px;font-size:14px;box-shadow:none;padding-left:6px;background:transparent url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23888%22 stroke-width=%221.7%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22m6 9 6 6 6-6%22/></svg>') no-repeat right 6px center;padding-right:20px;"><option value="and" ${combination === "and" ? "selected" : ""}>${window.siyuan.languages.filterCombinationAnd}</option><option value="or" ${combination === "or" ? "selected" : ""}>${window.siyuan.languages.filterCombinationOr}</option></select>`;+ `<select class="b3-select av__filter-select" data-type="toggleCombination" data-path="${groupPath}" style="width:${andOrControlWidth}px;"><option value="and" ${combination === "and" ? "selected" : ""}>${window.siyuan.languages.filterCombinationAnd}</option><option value="or" ${combination === "or" ? "selected" : ""}>${window.siyuan.languages.filterCombinationOr}</option></select>`;const genWhenLabel = () =>`<span style="margin:0;flex-shrink:0;width:${andOrControlWidth}px;box-sizing:border-box;height:28px;line-height:20px;font-size:14px;padding:0 20px 0 6px;display:inline-flex;align-items:center;color:var(--b3-theme-on-background);border:1px solid transparent;">${window.siyuan.languages.filterWhen}</span>`;@@ -279,7 +279,7 @@ export const getFiltersHTML = (data: IAV) => {const fieldOptions = fields.filter((f: IAVColumn) => f.type !== "lineNumber").map((f: IAVColumn) =>`<option value="${f.id}" ${f.id === node.column ? "selected" : ""}>${escapeHtml(f.name)}</option>`).join("");- const fieldSelect = `<select class="b3-select" data-type="fieldSelect" data-path="${path}" style="margin:0;flex-shrink:0;min-width:80px;max-width:120px;height:28px;line-height:20px;font-size:14px;box-shadow:none;padding-left:0;background:transparent url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23888%22 stroke-width=%221.7%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22m6 9 6 6 6-6%22/></svg>') no-repeat right 6px center;padding-right:20px;">${fieldOptions}</select>`;+ const fieldSelect = `<select class="b3-select av__filter-select" data-type="fieldSelect" data-path="${path}" style="min-width:80px;max-width:120px;padding-left:0;">${fieldOptions}</select>`;const fieldWrapper = `<span class="av__field-wrapper ariaLabel" data-position="4west" aria-label="${escapeAttr(colData.name)}" style="display:flex;align-items:center;flex-shrink:0;height:28px;background:transparent;border:1px solid var(--b3-theme-surface-lighter);border-radius:var(--b3-border-radius);padding:0 4px 0 6px;gap:2px;box-sizing:border-box;">${iconHTML}${fieldSelect}</span>`;const inlineHTML = genInlineFilterHTML(node, colData, path);const leafAndOrHTML = 0 === index ? genWhenLabel() : 1 === index ? genAndOrSelect(groupPath, groupCombination) : genAndOrLabel(groupCombination);@@ -447,11 +447,11 @@ const genInlineFilterHTML = (filter: IAVFilter, colData: IAVColumn, path: stringconst valueHidden = isEmptyOp ? " fn__none" : "";// 操作符 select- const operatorSelect = `<select class="b3-select" style="margin:0;flex-shrink:0;min-width:60px;height:28px;line-height:20px;font-size:14px;box-shadow:none;padding-left:6px;background:transparent url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23888%22 stroke-width=%221.7%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22m6 9 6 6 6-6%22/></svg>') no-repeat right 6px center;padding-right:20px;" data-type="operation" data-path="${path}">${getOperatorSelectByType(valueType, operator)}</select>`;+ const operatorSelect = `<select class="b3-select av__filter-select" data-type="operation" data-path="${path}">${getOperatorSelectByType(valueType, operator)}</select>`;// 量化器 select(rollup/mAsset 才有)const quantifierSelect = (isRollup || valueType === "mAsset")- ? `<select class="b3-select" style="margin:0;flex-shrink:0;min-width:60px;height:28px;line-height:20px;font-size:14px;box-shadow:none;padding-left:6px;background:transparent url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23888%22 stroke-width=%221.7%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22m6 9 6 6 6-6%22/></svg>') no-repeat right 6px center;padding-right:20px;" data-type="quantifier" data-path="${path}">+ ? `<select class="b3-select av__filter-select" data-type="quantifier" data-path="${path}"><option ${(!filter.quantifier || filter.quantifier === "Any") ? "selected" : ""} value="Any">${window.siyuan.languages.filterQuantifierAny}</option><option ${filter.quantifier === "All" ? "selected" : ""} value="All">${window.siyuan.languages.filterQuantifierAll}</option><option ${filter.quantifier === "None" ? "selected" : ""} value="None">${window.siyuan.languages.filterQuantifierNone}</option>@@ -464,16 +464,16 @@ const genInlineFilterHTML = (filter: IAVFilter, colData: IAVColumn, path: stringconst filterValue = filter.value;if (["text", "url", "block", "email", "phone", "template"].includes(valueType)) {const content = filterValue?.[valueType as "text"]?.content || "";- valueHTML = `<input class="b3-text-field b3-text-field--text" style="margin:0;box-shadow:none;background:transparent;flex:1;min-width:60px;height:28px;font-size:14px;" value="${escapeHtml(content)}" data-type="filterValue" data-path="${path}">`;+ valueHTML = `<input class="b3-text-field b3-text-field--text av__filter-input" value="${escapeHtml(content)}" data-type="filterValue" data-path="${path}">`;} else if (valueType === "mAsset") {const content = filterValue?.mAsset?.[0]?.content || "";- valueHTML = `<input class="b3-text-field b3-text-field--text" style="margin:0;box-shadow:none;background:transparent;flex:1;min-width:60px;height:28px;font-size:14px;" value="${escapeHtml(content)}" data-type="filterValue" data-path="${path}">`;+ valueHTML = `<input class="b3-text-field b3-text-field--text av__filter-input" value="${escapeHtml(content)}" data-type="filterValue" data-path="${path}">`;} else if (valueType === "number") {const content = filterValue?.number?.isNotEmpty ? filterValue.number.content : "";- valueHTML = `<input class="b3-text-field b3-text-field--text" style="margin:0;box-shadow:none;background:transparent;flex:1;min-width:50px;height:28px;font-size:14px;" value="${content}" data-type="filterValue" data-path="${path}">`;+ valueHTML = `<input class="b3-text-field b3-text-field--text av__filter-input" style="min-width:50px;" value="${content}" data-type="filterValue" data-path="${path}">`;} else if (valueType === "checkbox") {const isChecked = filterValue?.checkbox?.checked;- valueHTML = `<select class="b3-select" data-type="filterValue" data-path="${path}" style="margin:0;flex-shrink:0;min-width:60px;height:28px;line-height:20px;font-size:14px;box-shadow:none;padding-left:6px;background:transparent url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23888%22 stroke-width=%221.7%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22m6 9 6 6 6-6%22/></svg>') no-repeat right 6px center;padding-right:20px;"><option value="true" ${isChecked ? "selected" : ""}>${window.siyuan.languages.checked}</option><option value="false" ${!isChecked ? "selected" : ""}>${window.siyuan.languages.unchecked}</option></select>`;+ valueHTML = `<select class="b3-select av__filter-select" data-type="filterValue" data-path="${path}"><option value="true" ${isChecked ? "selected" : ""}>${window.siyuan.languages.checked}</option><option value="false" ${!isChecked ? "selected" : ""}>${window.siyuan.languages.unchecked}</option></select>`;} else if (["date", "created", "updated"].includes(valueType)) {valueHTML = genInlineDateHTML(filter, valueType, path);} else if (valueType === "select" || valueType === "mSelect") {@@ -482,10 +482,10 @@ const genInlineFilterHTML = (filter: IAVFilter, colData: IAVColumn, path: stringextraHTML = dropdown; // 下拉面板放 valueContainer 外,fixed 定位不影响行宽} else if (valueType === "relation") {const content = filterValue?.relation?.blockIDs?.[0] || "";- valueHTML = `<input class="b3-text-field b3-text-field--text" style="margin:0;box-shadow:none;background:transparent;flex:1;min-width:60px;height:28px;font-size:14px;" value="${escapeHtml(content)}" data-type="filterValue" data-type-rel="relation" data-path="${path}">`;+ valueHTML = `<input class="b3-text-field b3-text-field--text av__filter-input" value="${escapeHtml(content)}" data-type="filterValue" data-type-rel="relation" data-path="${path}">`;}- return `${quantifierSelect}${operatorSelect}<span class="av__filter-value${valueHidden}" data-type="valueContainer" data-path="${path}" style="display:inline-flex;align-items:center;flex:1;min-width:60px;">${valueHTML}</span>${extraHTML}`;+ return `${quantifierSelect}${operatorSelect}<span class="av__filter-value${valueHidden}" data-type="valueContainer" data-path="${path}">${valueHTML}</span>${extraHTML}`;};// genInlineDateHTML 生成日期类型的内联控件(绝对/相对切换 + Is between 结束日期)。@@ -496,30 +496,29 @@ const genInlineDateHTML = (filter: IAVFilter, valueType: TAVCol, path: string):const isBetween = filter.operator === "Is between";const dateBlock = (suffix: "" | "2", relativeDate: IAVRelativeDate, dateVal: any, showToday: boolean): string => {- const borderlessSelect = "margin:0;flex-shrink:0;min-width:60px;height:28px;line-height:20px;font-size:14px;box-shadow:none;padding-left:6px;background:transparent url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23888%22 stroke-width=%221.7%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22m6 9 6 6 6-6%22/></svg>') no-repeat right 6px center;padding-right:20px;";- const dateTypeSel = `<select class="b3-select" data-type="dateType${suffix}" data-path="${path}" style="${borderlessSelect}">+ const dateTypeSel = `<select class="b3-select av__filter-select" data-type="dateType${suffix}" data-path="${path}"><option value="time"${!relativeDate ? " selected" : ""}>${window.siyuan.languages.includeTime}</option><option value="custom"${relativeDate ? " selected" : ""}>${window.siyuan.languages.relativeToToday}</option></select>`;- const absDate = `<input value="${(dateVal && (dateVal.isNotEmpty || (suffix === "2" ? dateVal.isNotEmpty2 : valueType !== "date"))) ? dayjs(suffix === "2" ? dateVal.content2 : dateVal.content).format("YYYY-MM-DD") : ""}" type="date" max="9999-12-31" class="b3-text-field b3-text-field--text" data-type="absDate${suffix}" data-path="${path}" style="margin:0;box-shadow:none;background:transparent;height:28px;line-height:20px;font-size:14px;${relativeDate ? "display:none;" : ""}">`;- const relDir = `<select class="b3-select" data-type="dataDirection${suffix}" data-path="${path}" style="${borderlessSelect}${!relativeDate ? "display:none;" : ""}">+ const absDate = `<input value="${(dateVal && (dateVal.isNotEmpty || (suffix === "2" ? dateVal.isNotEmpty2 : valueType !== "date"))) ? dayjs(suffix === "2" ? dateVal.content2 : dateVal.content).format("YYYY-MM-DD") : ""}" type="date" max="9999-12-31" class="b3-text-field b3-text-field--text av__filter-input" data-type="absDate${suffix}" data-path="${path}" style="${relativeDate ? "display:none;" : ""}">`;+ const relDir = `<select class="b3-select av__filter-select" data-type="dataDirection${suffix}" data-path="${path}" style="${!relativeDate ? "display:none;" : ""}"><option value="-1"${relativeDate?.direction === -1 ? " selected" : ""}>${window.siyuan.languages.pastDate}</option><option value="1"${relativeDate?.direction === 1 ? " selected" : ""}>${window.siyuan.languages.nextDate}</option><option value="0"${showToday ? " selected" : ""}>${window.siyuan.languages.current}</option></select>`;- const relCount = `<input type="number" min="1" step="1" value="${relativeDate?.count || 1}" class="b3-text-field b3-text-field--text" data-type="relCount${suffix}" data-path="${path}" style="margin:0;box-shadow:none;background:transparent;height:28px;line-height:20px;font-size:14px;width:50px;${(!relativeDate || showToday) ? "display:none;" : ""}">`;- const relUnit = `<select class="b3-select" data-type="relUnit${suffix}" data-path="${path}" style="${borderlessSelect}${(!relativeDate || showToday) ? "display:none;" : ""}">+ const relCount = `<input type="number" min="1" step="1" value="${relativeDate?.count || 1}" class="b3-text-field b3-text-field--text av__filter-input" data-type="relCount${suffix}" data-path="${path}" style="width:50px;${(!relativeDate || showToday) ? "display:none;" : ""}">`;+ const relUnit = `<select class="b3-select av__filter-select" data-type="relUnit${suffix}" data-path="${path}" style="${(!relativeDate || showToday) ? "display:none;" : ""}"><option value="0"${relativeDate?.unit === 0 ? " selected" : ""}>${window.siyuan.languages.day}</option><option value="1"${(!relativeDate || relativeDate?.unit === 1) ? " selected" : ""}>${window.siyuan.languages.week}</option><option value="2"${relativeDate?.unit === 2 ? " selected" : ""}>${window.siyuan.languages.month}</option><option value="3"${relativeDate?.unit === 3 ? " selected" : ""}>${window.siyuan.languages.year}</option></select>`;- return `<span style="display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap;">${dateTypeSel}${absDate}${relDir}${relCount}${relUnit}</span>`;+ return `<span class="av__filter-date-row">${dateTypeSel}${absDate}${relDir}${relCount}${relUnit}</span>`;};const filter1 = dateBlock("", filter.relativeDate, dateValue, showToday1);const filter2 = dateBlock("2", filter.relativeDate2, dateValue, showToday2);- return `<span style="display:inline-flex;flex-direction:column;gap:6px;">${filter1}<span data-type="filter2Wrap" data-path="${path}" style="${isBetween ? "" : "display:none;"}">${filter2}</span></span>`;+ return `<span class="av__filter-date-col">${filter1}<span data-type="filter2Wrap" data-path="${path}" style="${isBetween ? "" : "display:none;"}">${filter2}</span></span>`;};// genInlineSelectHTML 生成 select/mSelect 的内联多选 chip 列表 + 搜索。@@ -534,7 +533,7 @@ const genInlineSelectHTML = (filter: IAVFilter, colData: IAVColumn, path: stringreturn `<span class="b3-chip b3-chip--middle" style="margin:1px 2px;background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${escapeHtml(item.content)}</span>`;}).join("");const triggerContent = selectedChips || `<span class="ft__on-surface fn__ellipsis" style="font-size:14px;">${placeholder}</span>`;- const trigger = `<span data-type="selectTrigger" data-path="${path}" style="display:inline-flex;align-items:center;flex:1;min-width:60px;cursor:pointer;overflow:hidden;padding-right:20px;background:transparent url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2210%22 height=%2210%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23888%22 stroke-width=%221.7%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22m6 9 6 6 6-6%22/></svg>') no-repeat right 6px center;">${triggerContent}</span>`;+ const trigger = `<span data-type="selectTrigger" data-path="${path}" class="av__select-trigger">${triggerContent}</span>`;// 下拉面板const searchInput = options.length > 5@@ -547,8 +546,8 @@ const genInlineSelectHTML = (filter: IAVFilter, colData: IAVColumn, path: string<span class="fn__ellipsis" style="min-width:0;">${escapeHtml(option.name)}</span></span>`;}).join("");- const dropdown = `<div data-type="selectDropdown" data-path="${path}" data-single="${isSingle ? "true" : "false"}" style="display:none;position:fixed;z-index:9999;width:fit-content;min-width:120px;max-height:240px;overflow-x:hidden;overflow-y:auto;padding:4px;box-shadow:var(--b3-dialog-shadow);border-radius:var(--b3-border-radius);background-color:var(--b3-menu-background);">-${searchInput}<div data-type="selectOptions" data-path="${path}" style="display:flex;flex-direction:column;width:100%;overflow:hidden;">${chips}</div>+ const dropdown = `<div data-type="selectDropdown" data-path="${path}" data-single="${isSingle ? "true" : "false"}" class="av__select-dropdown" style="display:none;">+${searchInput}<div data-type="selectOptions" data-path="${path}" class="av__select-options">${chips}</div></div>`;return {trigger, dropdown};};@@ -685,6 +684,9 @@ export const bindInlineFilterEvents = (panelElement: HTMLElement, data: IAV, pro}panelElement.dataset.filterEventsBound = "true";const menuElement = panelElement.querySelector(".b3-menu") as HTMLElement;+ if (!menuElement) {+ return;+ }const fields = getFieldsByData(data);// 通过 data-path 定位叶子行diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex 33801bf540..f2799854a2 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -169,7 +169,7 @@ export const openMenuPanel = (options: {document.body.insertAdjacentHTML("beforeend", `<div class="av__panel" style="z-index: ${++window.siyuan.zIndex};"><div class="b3-dialog__scrim" data-type="close"></div>- <div class="b3-menu" ${["select", "date", "asset", "relation", "rollup"].includes(options.type) ? `style="${["select", "asset", "relation"].includes(options.type) ? "max-height: calc(100vh - 32px);display: flex;flex-direction: column;" : ""}min-width: 200px;${isMobile() ? "max-width: 90vw;" : "max-width: 50vw;"}"` : (options.type === "filters" ? 'style="min-width: 340px;max-width: 80vw;width: fit-content;"' : "")}>${html}</div>+ <div class="b3-menu${options.type === "filters" ? " av__filter-panel" : ""}" ${["select", "date", "asset", "relation", "rollup"].includes(options.type) ? `style="${["select", "asset", "relation"].includes(options.type) ? "max-height: calc(100vh - 32px);display: flex;flex-direction: column;" : ""}min-width: 200px;${isMobile() ? "max-width: 90vw;" : "max-width: 50vw;"}"` : ""}>${html}</div></div>`);avPanelElement = document.querySelector(".av__panel");let closeCB: () => void;@@ -372,6 +372,7 @@ export const openMenuPanel = (options: {break;} else if (type === "go-config") {menuElement.innerHTML = getViewHTML(data);+ menuElement.classList.remove("av__filter-panel");setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);bindViewEvent({protyle: options.protyle, data, menuElement, blockElement: options.blockElement});window.siyuan.menus.menu.remove();@@ -397,6 +398,7 @@ export const openMenuPanel = (options: {break;} else if (type === "goSorts") {menuElement.innerHTML = getSortsHTML(fields, data.view.sorts);+ menuElement.classList.remove("av__filter-panel");bindSortsEvent(options.protyle, menuElement, data, blockID);setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);window.siyuan.menus.menu.remove();@@ -462,7 +464,7 @@ export const openMenuPanel = (options: {break;} else if (type === "goFilters") {menuElement.innerHTML = getFiltersHTML(data);- menuElement.setAttribute("style", "min-width: 340px;max-width: 80vw;width: fit-content;");+ menuElement.classList.add("av__filter-panel");bindInlineFilterEvents(avPanelElement as HTMLElement, data, options.protyle, blockID, avID);setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);window.siyuan.menus.menu.remove();@@ -593,6 +595,12 @@ export const openMenuPanel = (options: {}]);menuElement.innerHTML = getFiltersHTML(data);setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);+ // 滚动到新分组+ const groups = getEditableFilters(data);+ const newGroupIdx = groups.length - 1;+ const newGroupPath = btnPath ? `${btnPath},${newGroupIdx}` : `${newGroupIdx}`;+ const newGroupEl = menuElement.querySelector(`.av__filter-group-item[data-path="${newGroupPath}"]`) as HTMLElement;+ newGroupEl?.scrollIntoView({behavior: "smooth", block: "nearest"});}});event.preventDefault();