Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Support database filter composition https://github.com/siyuan-note/siyuan/issues/10550

Daniel6b416ae1b7a6
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index 3e34d58d44..b029866c94 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -929,6 +929,18 @@
}
}
+ // “当/且/或”只读标签,盒模型与 b3-select 对齐以保证垂直居中一致
+ .av__filter-label {
+ flex-shrink: 0;
+ height: 28px;
+ line-height: 20px;
+ padding: 4px 0;
+ box-sizing: border-box;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ }
+
.av__filter-group-left {
flex-shrink: 0;
display: flex;
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts
index c840719642..572179ba2b 100644
--- a/app/src/protyle/render/av/filter.ts
+++ b/app/src/protyle/render/av/filter.ts
@@ -218,15 +218,16 @@ export const getFiltersHTML = (data: IAV) => {
andOrTextWidth = Math.max(andOrTextWidth, measureEl.offsetWidth);
});
document.body.removeChild(measureEl);
- const andOrControlWidth = andOrTextWidth + 28;
+ // 宽度需容纳文字 + b3-select 的左右 padding(8 + 26)+ 余量
+ const andOrControlWidth = andOrTextWidth + 36;
const genAndOrSelect = (groupPath: string, combination: string) =>
`<select class="b3-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 class="ft__on-surface" style="width:${andOrControlWidth}px;height:28px;line-height:28px;display:inline-block;">${window.siyuan.languages.filterWhen}</span>`;
+ `<span class="av__filter-label ft__on-surface" style="width:${andOrControlWidth}px;">${window.siyuan.languages.filterWhen}</span>`;
const genAndOrLabel = (combination: string) =>
- `<span class="ft__on-surface" style="width:${andOrControlWidth}px;height:28px;line-height:28px;display:inline-block;">${combination === "or" ? window.siyuan.languages.filterCombinationOr : window.siyuan.languages.filterCombinationAnd}</span>`;
+ `<span class="av__filter-label ft__on-surface" style="width:${andOrControlWidth}px;">${combination === "or" ? window.siyuan.languages.filterCombinationOr : window.siyuan.languages.filterCombinationAnd}</span>`;
const genNodeHTML = (node: IAVFilter, path: string, depth: number, groupPath: string, groupCombination: string, index: number = 0): string => {
if (!node) {