mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
This commit is contained in:
parent
78c3479fc3
commit
a105227e65
7 changed files with 27 additions and 9 deletions
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
&__pulse {
|
&__pulse {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
height: 23px;
|
height: 22px;
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
|
|
@ -825,6 +825,12 @@ export const updateAttrViewCellAnimation = (cellElement: HTMLElement, value: IAV
|
||||||
const viewType = blockElement.getAttribute("data-av-type") as TAVView;
|
const viewType = blockElement.getAttribute("data-av-type") as TAVView;
|
||||||
const iconElement = cellElement.querySelector(".b3-menu__avemoji");
|
const iconElement = cellElement.querySelector(".b3-menu__avemoji");
|
||||||
if (viewType === "gallery") {
|
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.innerHTML = renderCell(value, 0, iconElement ? !iconElement.classList.contains("fn__none") : false, viewType) +
|
||||||
cellElement.querySelector(".av__gallery-tip").outerHTML;
|
cellElement.querySelector(".av__gallery-tip").outerHTML;
|
||||||
cellElement.setAttribute("data-empty", cellValueIsEmpty(value).toString());
|
cellElement.setAttribute("data-empty", cellValueIsEmpty(value).toString());
|
||||||
|
|
|
||||||
|
|
@ -977,8 +977,8 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0, showIcon = tru
|
||||||
});
|
});
|
||||||
} else if (cellValue.type === "checkbox") {
|
} 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>`;
|
text += `<div class="fn__flex"><svg class="av__checkbox"><use xlink:href="#icon${cellValue?.checkbox?.checked ? "Check" : "Uncheck"}"></use></svg>`;
|
||||||
if (type === "gallery") {
|
if (type === "gallery" && cellValue?.checkbox?.content) {
|
||||||
text += `<span class="fn__space"></span>${window.siyuan.languages.checkbox}`;
|
text += `<span class="fn__space"></span>${cellValue?.checkbox?.content}`;
|
||||||
}
|
}
|
||||||
text += "</div>";
|
text += "</div>";
|
||||||
} else if (cellValue.type === "rollup") {
|
} else if (cellValue.type === "rollup") {
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,18 @@ export const insertGalleryItemAnimation = (options: {
|
||||||
let html = "";
|
let html = "";
|
||||||
let needUpdate = "";
|
let needUpdate = "";
|
||||||
if (options.blockElement.querySelector('.av__views [data-type="av-sort"]').classList.contains("block__icon--active") &&
|
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"';
|
needUpdate = ' data-need-update="true"';
|
||||||
}
|
}
|
||||||
const coverClass = sideItemElement?.querySelector(".av__gallery-cover")?.className || "fn__none";
|
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) => {
|
options.srcIDs.forEach((id) => {
|
||||||
html += `<div class="av__gallery-item"${needUpdate} data-type="ghost" data-id="${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="${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>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
if (options.previousId && sideItemElement) {
|
if (options.previousId && sideItemElement) {
|
||||||
|
|
@ -119,13 +123,17 @@ export const insertGalleryItemAnimation = (options: {
|
||||||
break;
|
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 sideItemCellElement = sideItemElement.querySelector(`.av__cell[data-field-id="${item.column}"]`) as HTMLElement;
|
||||||
const cellElement = currentItemElement.querySelector(`.av__cell[data-field-id="${item.column}"]`);
|
const cellElement = currentItemElement.querySelector(`.av__cell[data-field-id="${item.column}"]`);
|
||||||
const cellValue = genCellValueByElement(getTypeByCellElement(sideItemCellElement), sideItemCellElement);
|
const cellValue = genCellValueByElement(getTypeByCellElement(sideItemCellElement), sideItemCellElement);
|
||||||
const iconElement = cellElement.querySelector(".b3-menu__avemoji");
|
const iconElement = cellElement.querySelector(".b3-menu__avemoji");
|
||||||
|
if (cellValue.type === "checkbox") {
|
||||||
|
cellValue.checkbox.content = cellElement.getAttribute("aria-label");
|
||||||
|
}
|
||||||
cellElement.innerHTML = renderCell(cellValue, undefined,
|
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);
|
renderCellAttr(cellElement, cellValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@ const getGalleryHTML = (data: IAVGallery, selectItemIds: string[], editIds: stri
|
||||||
if (data.fields[fieldsIndex].desc) {
|
if (data.fields[fieldsIndex].desc) {
|
||||||
ariaLabel += escapeAttr(`<div class="ft__on-surface">${data.fields[fieldsIndex].desc}</div>`);
|
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}"
|
galleryHTML += `<div class="av__cell${checkClass} ariaLabel" data-wrap="${data.fields[fieldsIndex].wrap}"
|
||||||
data-empty="${isEmpty}"
|
data-empty="${isEmpty}"
|
||||||
aria-label="${ariaLabel}"
|
aria-label="${ariaLabel}"
|
||||||
|
|
|
||||||
|
|
@ -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");
|
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")) {
|
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>';
|
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;
|
const pinIndex = previousElement.querySelectorAll(".av__colsticky .av__cell").length - 1;
|
||||||
|
|
|
||||||
3
app/src/types/index.d.ts
vendored
3
app/src/types/index.d.ts
vendored
|
|
@ -995,7 +995,8 @@ interface IAVCellValue {
|
||||||
content: string
|
content: string
|
||||||
},
|
},
|
||||||
checkbox?: {
|
checkbox?: {
|
||||||
checked: boolean
|
checked: boolean,
|
||||||
|
content?: string, // gallery 中显示 https://github.com/siyuan-note/siyuan/issues/15389
|
||||||
}
|
}
|
||||||
relation?: IAVCellRelationValue
|
relation?: IAVCellRelationValue
|
||||||
rollup?: {
|
rollup?: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue