mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 08:00:13 +01:00
This commit is contained in:
parent
501f657f7c
commit
69068b0c78
4 changed files with 27 additions and 8 deletions
|
|
@ -920,6 +920,16 @@
|
||||||
&:hover .av__group-icon--hover {
|
&:hover .av__group-icon--hover {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.b3-chip {
|
||||||
|
padding: 2px 6px;
|
||||||
|
line-height: calc(1.625em - 4px);
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
& + .av__body .av__gallery {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-counter {
|
&-counter {
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ const renderGroupGallery = (options: ITableOptions) => {
|
||||||
});
|
});
|
||||||
if (options.renderAll) {
|
if (options.renderAll) {
|
||||||
options.blockElement.firstElementChild.outerHTML = `<div class="av__container fn__block">
|
options.blockElement.firstElementChild.outerHTML = `<div class="av__container fn__block">
|
||||||
${genTabHeaderHTML(options.data, isSearching || !!query, options.protyle.disabled || !!hasClosestByAttribute(options.blockElement, "data-type", "NodeBlockQueryEmbed"))}
|
${genTabHeaderHTML(options.data, isSearching || !!query, !options.protyle.disabled && !hasClosestByAttribute(options.blockElement, "data-type", "NodeBlockQueryEmbed"))}
|
||||||
<div>
|
<div>
|
||||||
${avBodyHTML}
|
${avBodyHTML}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -143,7 +143,7 @@ const afterRenderGallery = (options: ITableOptions) => {
|
||||||
(options.blockElement.querySelector(".av__body") as HTMLElement).dataset.pageSize = options.resetData.pageSizes[groupId];
|
(options.blockElement.querySelector(".av__body") as HTMLElement).dataset.pageSize = options.resetData.pageSizes[groupId];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const bodyElement = options.blockElement.querySelector(`.av__body[data-group-id="${groupId}"]`) as HTMLElement
|
const bodyElement = options.blockElement.querySelector(`.av__body[data-group-id="${groupId}"]`) as HTMLElement;
|
||||||
if (bodyElement) {
|
if (bodyElement) {
|
||||||
bodyElement.dataset.pageSize = options.resetData.pageSizes[groupId];
|
bodyElement.dataset.pageSize = options.resetData.pageSizes[groupId];
|
||||||
}
|
}
|
||||||
|
|
@ -162,9 +162,6 @@ const afterRenderGallery = (options: ITableOptions) => {
|
||||||
if (options.cb) {
|
if (options.cb) {
|
||||||
options.cb(options.data);
|
options.cb(options.data);
|
||||||
}
|
}
|
||||||
if (options.data.view.hideAttrViewName) {
|
|
||||||
options.blockElement.querySelector(".av__gallery").classList.add("av__gallery--top");
|
|
||||||
}
|
|
||||||
if (!options.renderAll) {
|
if (!options.renderAll) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -302,7 +299,7 @@ export const renderGallery = async (options: {
|
||||||
const bodyHTML = getGalleryHTML(view, selectItemIds, editIds);
|
const bodyHTML = getGalleryHTML(view, selectItemIds, editIds);
|
||||||
if (options.renderAll) {
|
if (options.renderAll) {
|
||||||
options.blockElement.firstElementChild.outerHTML = `<div class="av__container fn__block">
|
options.blockElement.firstElementChild.outerHTML = `<div class="av__container fn__block">
|
||||||
${genTabHeaderHTML(data, resetData.isSearching || !!resetData.query, options.protyle.disabled || !!hasClosestByAttribute(options.blockElement, "data-type", "NodeBlockQueryEmbed"))}
|
${genTabHeaderHTML(data, resetData.isSearching || !!resetData.query, !options.protyle.disabled && !hasClosestByAttribute(options.blockElement, "data-type", "NodeBlockQueryEmbed"))}
|
||||||
<div>
|
<div>
|
||||||
<div class="av__body" data-page-size="${view.pageSize}">
|
<div class="av__body" data-page-size="${view.pageSize}">
|
||||||
${bodyHTML}
|
${bodyHTML}
|
||||||
|
|
@ -323,4 +320,7 @@ export const renderGallery = async (options: {
|
||||||
protyle: options.protyle,
|
protyle: options.protyle,
|
||||||
blockElement: options.blockElement,
|
blockElement: options.blockElement,
|
||||||
});
|
});
|
||||||
|
if (options.data.view.hideAttrViewName) {
|
||||||
|
options.blockElement.querySelector(".av__gallery").classList.add("av__gallery--top");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -225,12 +225,20 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGroupTitleHTML = (group: IAVView, counter: number) => {
|
export const getGroupTitleHTML = (group: IAVView, counter: number) => {
|
||||||
|
let nameHTML = '';
|
||||||
|
if (["mSelect", "select"].includes(group.groupValue.type)) {
|
||||||
|
group.groupValue.mSelect.forEach((item) => {
|
||||||
|
nameHTML += `<span class="b3-chip" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${escapeHtml(item.content)}</span>`;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
nameHTML = group.name;
|
||||||
|
}
|
||||||
return `<div class="av__group-title">
|
return `<div class="av__group-title">
|
||||||
<div class="av__group-icon" data-type="av-group-fold" data-id="${group.id}">
|
<div class="av__group-icon" data-type="av-group-fold" data-id="${group.id}">
|
||||||
<svg class="${group.groupFolded ? "" : "av__group-arrow--open"}"><use xlink:href="#iconRight"></use></svg>
|
<svg class="${group.groupFolded ? "" : "av__group-arrow--open"}"><use xlink:href="#iconRight"></use></svg>
|
||||||
</div>
|
</div>
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
${group.name}
|
${nameHTML}
|
||||||
<span class="${counter === 0 ? "fn__none" : "av__group-counter"}">${counter}</span>
|
<span class="${counter === 0 ? "fn__none" : "av__group-counter"}">${counter}</span>
|
||||||
<span class="av__group-icon av__group-icon--hover ariaLabel" data-type="av-add-top" data-position="north" aria-label="${window.siyuan.languages.newRow}"><svg><use xlink:href="#iconAdd"></use></svg></span>
|
<span class="av__group-icon av__group-icon--hover ariaLabel" data-type="av-add-top" data-position="north" aria-label="${window.siyuan.languages.newRow}"><svg><use xlink:href="#iconAdd"></use></svg></span>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
@ -609,7 +617,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
||||||
// hide
|
// hide
|
||||||
titleElement.classList.add("fn__none");
|
titleElement.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
if (item.getAttribute("data-av-type") === "gallery") {
|
if (item.getAttribute("data-av-type") === "gallery" && !item.querySelector(".av__group-title")) {
|
||||||
const galleryElement = item.querySelector(".av__gallery");
|
const galleryElement = item.querySelector(".av__gallery");
|
||||||
if (!operation.data) {
|
if (!operation.data) {
|
||||||
galleryElement.classList.remove("av__gallery--top");
|
galleryElement.classList.remove("av__gallery--top");
|
||||||
|
|
|
||||||
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
|
@ -863,6 +863,7 @@ interface IAVView {
|
||||||
sorts: IAVSort[],
|
sorts: IAVSort[],
|
||||||
groups: IAVView[]
|
groups: IAVView[]
|
||||||
group: IAVGroup
|
group: IAVGroup
|
||||||
|
groupValue: IAVCellValue
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAVTable extends IAVView {
|
interface IAVTable extends IAVView {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue