Vanessa 2025-07-30 12:08:15 +08:00
parent 78c3479fc3
commit a105227e65
7 changed files with 27 additions and 9 deletions

View file

@ -35,7 +35,7 @@
&__pulse {
width: 70%;
height: 23px;
height: 22px;
display: block;
position: relative;
overflow: hidden;

View file

@ -825,6 +825,12 @@ export const updateAttrViewCellAnimation = (cellElement: HTMLElement, value: IAV
const viewType = blockElement.getAttribute("data-av-type") as TAVView;
const iconElement = cellElement.querySelector(".b3-menu__avemoji");
if (viewType === "gallery") {
if (value.type === "checkbox") {
value.checkbox = {
checked: value.checkbox?.checked || false,
content: cellElement.getAttribute("aria-label"),
};
}
cellElement.innerHTML = renderCell(value, 0, iconElement ? !iconElement.classList.contains("fn__none") : false, viewType) +
cellElement.querySelector(".av__gallery-tip").outerHTML;
cellElement.setAttribute("data-empty", cellValueIsEmpty(value).toString());

View file

@ -977,8 +977,8 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0, showIcon = tru
});
} else if (cellValue.type === "checkbox") {
text += `<div class="fn__flex"><svg class="av__checkbox"><use xlink:href="#icon${cellValue?.checkbox?.checked ? "Check" : "Uncheck"}"></use></svg>`;
if (type === "gallery") {
text += `<span class="fn__space"></span>${window.siyuan.languages.checkbox}`;
if (type === "gallery" && cellValue?.checkbox?.content) {
text += `<span class="fn__space"></span>${cellValue?.checkbox?.content}`;
}
text += "</div>";
} else if (cellValue.type === "rollup") {

View file

@ -25,14 +25,18 @@ export const insertGalleryItemAnimation = (options: {
let html = "";
let needUpdate = "";
if (options.blockElement.querySelector('.av__views [data-type="av-sort"]').classList.contains("block__icon--active") &&
!options.blockElement.querySelector(groupQuery+'[data-type="av-load-more"]').classList.contains("fn__none")) {
!options.blockElement.querySelector(groupQuery + '[data-type="av-load-more"]').classList.contains("fn__none")) {
needUpdate = ' data-need-update="true"';
}
const coverClass = sideItemElement?.querySelector(".av__gallery-cover")?.className || "fn__none";
let cellsHTML = "";
sideItemElement.querySelectorAll(".av__cell").forEach((item:HTMLElement) => {
cellsHTML += `<div class="av__cell" aria-label="${item.getAttribute("aria-label")}" data-field-id="${item.dataset.fieldId}"><span class="av__pulse"></span>${item.querySelector(".av__gallery-tip").outerHTML}</div>`;
});
options.srcIDs.forEach((id) => {
html += `<div class="av__gallery-item"${needUpdate} data-type="ghost" data-id="${id}">
<div class="${coverClass}"><span style="width: 100%;height: 100%;border-radius: var(--b3-border-radius) var(--b3-border-radius) 0 0;" class="av__pulse"></span></div>
<div class="av__gallery-fields"><span class="av__pulse"></span></div>
<div class="av__gallery-fields">${cellsHTML}</div>
</div>`;
});
if (options.previousId && sideItemElement) {
@ -119,13 +123,17 @@ export const insertGalleryItemAnimation = (options: {
break;
}
}
if (sideItemElement.classList.contains("av__row") && isRenderValue) {
if (sideItemElement.classList.contains("av__gallery-item") && isRenderValue) {
const sideItemCellElement = sideItemElement.querySelector(`.av__cell[data-field-id="${item.column}"]`) as HTMLElement;
const cellElement = currentItemElement.querySelector(`.av__cell[data-field-id="${item.column}"]`);
const cellValue = genCellValueByElement(getTypeByCellElement(sideItemCellElement), sideItemCellElement);
const iconElement = cellElement.querySelector(".b3-menu__avemoji");
if (cellValue.type === "checkbox") {
cellValue.checkbox.content = cellElement.getAttribute("aria-label");
}
cellElement.innerHTML = renderCell(cellValue, undefined,
iconElement ? !iconElement.classList.contains("fn__none") : false, "gallery");
iconElement ? !iconElement.classList.contains("fn__none") : false, "gallery") +
cellElement.querySelector(".av__gallery-tip").outerHTML;
renderCellAttr(cellElement, cellValue);
}
});

View file

@ -62,6 +62,9 @@ const getGalleryHTML = (data: IAVGallery, selectItemIds: string[], editIds: stri
if (data.fields[fieldsIndex].desc) {
ariaLabel += escapeAttr(`<div class="ft__on-surface">${data.fields[fieldsIndex].desc}</div>`);
}
if (cell.valueType === "checkbox") {
cell.value["checkbox"].content = data.fields[fieldsIndex].name||getColNameByType(data.fields[fieldsIndex].type)
}
galleryHTML += `<div class="av__cell${checkClass} ariaLabel" data-wrap="${data.fields[fieldsIndex].wrap}"
data-empty="${isEmpty}"
aria-label="${ariaLabel}"

View file

@ -128,7 +128,7 @@ export const insertAttrViewBlockAnimation = (options: {
let previousElement = options.blockElement.querySelector(`.av__row[data-id="${options.previousId}"]`) || options.blockElement.querySelector(groupQuery + ".av__row--header");
// 有排序需要加入最后一行
if (options.blockElement.querySelector('.av__views [data-type="av-sort"]').classList.contains("block__icon--active")) {
previousElement = options.blockElement.querySelector("groupQuery + .av__row--util").previousElementSibling;
previousElement = options.blockElement.querySelector(groupQuery + ".av__row--util").previousElementSibling;
}
let colHTML = '<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div></div>';
const pinIndex = previousElement.querySelectorAll(".av__colsticky .av__cell").length - 1;

View file

@ -995,7 +995,8 @@ interface IAVCellValue {
content: string
},
checkbox?: {
checked: boolean
checked: boolean,
content?: string, // gallery 中显示 https://github.com/siyuan-note/siyuan/issues/15389
}
relation?: IAVCellRelationValue
rollup?: {