Vanessa 2025-07-04 16:55:55 +08:00
parent eafe42fe59
commit 168b373a0c
2 changed files with 7 additions and 11 deletions

View file

@ -164,12 +164,7 @@ export const bindViewEvent = (options: {
export const getViewHTML = (data: IAV) => {
const view = data.view;
let fields: IAVColumn[];
if (data.viewType === "table") {
fields = (view as IAVTable).columns;
} else if (data.viewType === "gallery") {
fields = (view as IAVGallery).fields;
}
const fields = getFieldsByData(data);
return `<div class="b3-menu__items">
<button class="b3-menu__item" data-type="nobg">
<span class="b3-menu__label ft__center">${window.siyuan.languages.config}</span>
@ -219,7 +214,7 @@ export const getViewHTML = (data: IAV) => {
<button class="b3-menu__item" data-type="goGroups">
<svg class="b3-menu__icon"><use xlink:href="#iconGroups"></use></svg>
<span class="b3-menu__label">${window.siyuan.languages.group}</span>
<span class="b3-menu__accelerator">${view.filters.length}</span>
<span class="b3-menu__accelerator">${data.view.groups ? fields.filter((item: IAVColumn) => item.id === data.view.groups.field)[0].name : ""}</span>
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
</button>
<button class="b3-menu__separator"></button>

View file

@ -839,12 +839,15 @@ interface IAVView {
pageSize: number;
showIcon: boolean;
wrapField: boolean;
filters: IAVFilter[],
sorts: IAVSort[],
groups: {
field: string,
}
}
interface IAVTable extends IAVView {
columns: IAVColumn[],
filters: IAVFilter[],
sorts: IAVSort[],
rows: IAVRow[],
rowCount: number,
}
@ -858,8 +861,6 @@ interface IAVGallery extends IAVView {
cards: IAVGalleryItem[],
desc: string
fields: IAVColumn[]
filters: IAVFilter[],
sorts: IAVSort[],
cardCount: number,
}