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

Danielce0651b3a2f9
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index b09dbf3f6a..8a841dae91 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -919,8 +919,8 @@
.av__filter-group-item {
padding: 0 8px;
- margin: 4px 0;
- gap: 4px;
+ margin: 6px 0;
+ gap: 6px;
&:hover > .b3-menu__action {
opacity: 1;
@@ -940,8 +940,8 @@
min-width: 0;
display: flex;
flex-direction: column;
- gap: 4px;
- padding: 4px 0;
+ gap: 6px;
+ padding: 6px 0;
border-radius: var(--b3-border-radius);
border: 1px solid var(--b3-theme-surface-lighter);
@@ -979,8 +979,8 @@
}
.b3-menu__item.av__filter-row {
- margin: 4px 0;
- gap: 4px;
+ margin: 6px 0;
+ gap: 6px;
}
.av__filter-group-children .b3-menu__item.av__filter-row,
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts
index a9e9e27749..e9cade1296 100644
--- a/app/src/protyle/render/av/filter.ts
+++ b/app/src/protyle/render/av/filter.ts
@@ -209,14 +209,24 @@ export const addFilter = (options: {
export const getFiltersHTML = (data: IAV) => {
let html = "";
const fields = getFieldsByData(data);
+ const measureEl = document.createElement("span");
+ measureEl.style.cssText = "position:absolute;visibility:hidden;font-size:14px;white-space:nowrap;";
+ document.body.appendChild(measureEl);
+ let andOrTextWidth = 0;
+ [window.siyuan.languages.filterWhen, window.siyuan.languages.filterCombinationAnd, window.siyuan.languages.filterCombinationOr].forEach(t => {
+ measureEl.textContent = t;
+ andOrTextWidth = Math.max(andOrTextWidth, measureEl.offsetWidth);
+ });
+ 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;height:28px;line-height:20px;font-size:12px;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" 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>`;
const genWhenLabel = () =>
- `<span style="margin:0;flex-shrink:0;height:28px;line-height:20px;font-size:12px;padding:0 20px 0 6px;display:inline-flex;align-items:center;color:var(--b3-theme-on-background);box-sizing:border-box;border:1px solid transparent;">${window.siyuan.languages.filterWhen}</span>`;
+ `<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>`;
const genAndOrLabel = (combination: string) =>
- `<span style="margin:0;flex-shrink:0;height:28px;line-height:20px;font-size:12px;padding:0 20px 0 6px;display:inline-flex;align-items:center;color:var(--b3-theme-on-background);box-sizing:border-box;border:1px solid transparent;">${combination === "or" ? window.siyuan.languages.filterCombinationOr : window.siyuan.languages.filterCombinationAnd}</span>`;
+ `<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;">${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) {
@@ -237,8 +247,8 @@ export const getFiltersHTML = (data: IAV) => {
const depthClass = `av__filter-group-children--depth${Math.min(depth, 3)}`;
const addConditionBtn = depth >= 3
- ? `<span class="block__icon ariaLabel" data-position="4north" data-type="addFilter" data-path="${path}" aria-label="${window.siyuan.languages.addFilterCondition}" style="font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:2px;padding:0;"><svg style="width:10px;height:10px;"><use xlink:href="#iconAdd"></use></svg>${window.siyuan.languages.addFilterCondition}</span>`
- : `<span class="block__icon ariaLabel" data-position="4north" data-type="addFilterCondition" data-path="${path}" data-depth="${depth}" aria-label="${window.siyuan.languages.addFilterCondition}" style="font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:2px;padding:0;"><svg style="width:10px;height:10px;"><use xlink:href="#iconAdd"></use></svg>${window.siyuan.languages.addFilterCondition}<svg style="width:10px;height:10px;flex-shrink:0;"><use xlink:href="#iconDown"></use></svg></span>`;
+ ? `<span class="block__icon ariaLabel" data-position="4north" data-type="addFilter" data-path="${path}" aria-label="${window.siyuan.languages.addFilterCondition}" style="font-size:14px;cursor:pointer;display:inline-flex;align-items:center;gap:2px;padding:0;"><svg style="width:10px;height:10px;"><use xlink:href="#iconAdd"></use></svg>${window.siyuan.languages.addFilterCondition}</span>`
+ : `<span class="block__icon ariaLabel" data-position="4north" data-type="addFilterCondition" data-path="${path}" data-depth="${depth}" aria-label="${window.siyuan.languages.addFilterCondition}" style="font-size:14px;cursor:pointer;display:inline-flex;align-items:center;gap:2px;padding:0;"><svg style="width:10px;height:10px;"><use xlink:href="#iconAdd"></use></svg>${window.siyuan.languages.addFilterCondition}<svg style="width:10px;height:10px;flex-shrink:0;"><use xlink:href="#iconDown"></use></svg></span>`;
const andOrHTML = 0 === index ? genWhenLabel() : 1 === index ? genAndOrSelect(groupPath, groupCombination) : genAndOrLabel(groupCombination);
return `<div class="av__filter-group-item" data-path="${path}" style="display:flex;align-items:center;">
@@ -269,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:12px;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" 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 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);
@@ -297,8 +307,8 @@ export const getFiltersHTML = (data: IAV) => {
${html}
<button class="b3-menu__item" data-type="addFilterCondition" data-path="" data-depth="0">
<svg class="b3-menu__icon"><use xlink:href="#iconAdd"></use></svg>
- <span class="b3-menu__label">${window.siyuan.languages.addFilterCondition}</span>
- <svg class="b3-menu__icon" style="width:10px;height:10px;"><use xlink:href="#iconDown"></use></svg>
+ <span class="b3-menu__label" style="flex:none;">${window.siyuan.languages.addFilterCondition}</span>
+ <svg style="width:10px;height:10px;flex-shrink:0;align-self:center;margin-left:4px;"><use xlink:href="#iconDown"></use></svg>
</button>
<button class="b3-menu__item b3-menu__item--warning${leafCount > 0 ? "" : " fn__none"}" data-type="removeFilters">
<svg class="b3-menu__icon"><use xlink:href="#iconTrashcan"></use></svg>
@@ -437,11 +447,11 @@ const genInlineFilterHTML = (filter: IAVFilter, colData: IAVColumn, path: string
const 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:12px;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" 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>`;
// 量化器 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:12px;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" 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}">
<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>
@@ -454,16 +464,16 @@ const genInlineFilterHTML = (filter: IAVFilter, colData: IAVColumn, path: string
const 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:12px;" value="${escapeHtml(content)}" data-type="filterValue" data-path="${path}">`;
+ 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}">`;
} 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:12px;" value="${escapeHtml(content)}" data-type="filterValue" data-path="${path}">`;
+ 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}">`;
} 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:12px;" value="${content}" data-type="filterValue" data-path="${path}">`;
+ 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}">`;
} 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:12px;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" 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>`;
} else if (["date", "created", "updated"].includes(valueType)) {
valueHTML = genInlineDateHTML(filter, valueType, path);
} else if (valueType === "select" || valueType === "mSelect") {
@@ -472,7 +482,7 @@ const genInlineFilterHTML = (filter: IAVFilter, colData: IAVColumn, path: string
extraHTML = 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:12px;" value="${escapeHtml(content)}" data-type="filterValue" data-type-rel="relation" data-path="${path}">`;
+ 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}">`;
}
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}`;
@@ -486,18 +496,18 @@ 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:12px;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 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}">
<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:12px;${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" 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;" : ""}">
<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:12px;width:50px;${(!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" 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;" : ""}">
<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>
@@ -523,12 +533,12 @@ const genInlineSelectHTML = (filter: IAVFilter, colData: IAVColumn, path: string
const selectedChips = selectedValues.map((item: IAVCellSelectValue) => {
return `<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:12px;">${placeholder}</span>`;
+ 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 searchInput = options.length > 5
- ? `<input class="b3-text-field" placeholder="${window.siyuan.languages.search}" data-type="filterSearch" data-path="${path}" style="margin:0 0 4px 0;height:28px;font-size:12px;width:100%;">`
+ ? `<input class="b3-text-field" placeholder="${window.siyuan.languages.search}" data-type="filterSearch" data-path="${path}" style="margin:0 0 4px 0;height:28px;font-size:14px;width:100%;">`
: "";
const chips = options.map((option: { name: string; color: string; desc?: string }) => {
const selected = selectedValues.some((s: IAVCellSelectValue) => s.content === option.name);
@@ -867,7 +877,7 @@ export const bindInlineFilterEvents = (panelElement: HTMLElement, data: IAV, pro
selectedChips.push(`<span class="b3-chip b3-chip--middle" style="margin:1px 2px;background-color:var(--b3-font-background${color});color:var(--b3-font-color${color})">${escapeHtml(name)}</span>`);
}
});
- const contentHTML = selectedChips.join("") || `<span class="ft__on-surface fn__ellipsis" style="font-size:12px;">${placeholderStr}</span>`;
+ const contentHTML = selectedChips.join("") || `<span class="ft__on-surface fn__ellipsis" style="font-size:14px;">${placeholderStr}</span>`;
triggerEl.innerHTML = contentHTML;
}
saveRow(row, path, false);