This commit is contained in:
Vanessa 2023-07-31 11:32:36 +08:00
parent 0b5f9bce98
commit 87dcbcd58c
6 changed files with 31 additions and 32 deletions

View file

@ -55,7 +55,7 @@ export const setFilter = (options: {
const rectTarget = options.target.getBoundingClientRect();
const menu = new Menu("set-filter-" + options.filter.column, () => {
const oldFilters = JSON.parse(JSON.stringify(options.data.view.filters));
const operator = (window.siyuan.menus.menu.element.querySelector(".b3-select") as HTMLSelectElement).value as TAVFilterOperator
const operator = (window.siyuan.menus.menu.element.querySelector(".b3-select") as HTMLSelectElement).value as TAVFilterOperator;
let hasMatch = false;
let cellValue: IAVCellValue;
if (textElements.length > 0) {
@ -268,7 +268,7 @@ export const setFilter = (options: {
event.preventDefault();
}
});
})
});
toggleEmpty(selectElement, selectElement.value, colData.type);
menu.open({x: rectTarget.left, y: rectTarget.bottom});
if (textElements.length > 0) {

View file

@ -23,7 +23,7 @@ export const openMenuPanel = (options: {
}
window.siyuan.menus.menu.remove();
const avID = options.blockElement.getAttribute("data-av-id");
const nodeID = options.blockElement.getAttribute("data-node-id")
const nodeID = options.blockElement.getAttribute("data-node-id");
fetchPost("/api/av/renderAttributeView", {
id: avID,
nodeID

View file

@ -200,7 +200,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
};
const genAVValueHTML = (value: IAVCellValue) => {
let html = ""
let html = "";
switch (value.type) {
case "text":
html = `<input value="${value.text.content}" class="b3-text-field b3-text-field--text fn__flex-1">`;
@ -212,7 +212,7 @@ const genAVValueHTML = (value: IAVCellValue) => {
case "select":
value.mSelect?.forEach(item => {
html += `<span class="b3-chip b3-chip--middle" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}</span>`;
})
});
break;
case "date":
html = `<input value="${dayjs(value.date.content).format("YYYY-MM-DD HH:mm")}" type="datetime-local" class="b3-text-field b3-text-field--text fn__flex-1">`;
@ -226,11 +226,11 @@ const genAVValueHTML = (value: IAVCellValue) => {
break;
}
return html;
}
};
export const renderAVAttribute = (element: HTMLElement, id: string) => {
fetchPost("/api/av/getAttributeViewKeys", {id}, (response) => {
let html = ""
let html = "";
response.data.forEach((table: {
keyValues: {
key: {
@ -254,9 +254,9 @@ export const renderAVAttribute = (element: HTMLElement, id: string) => {
<div class="fn__flex-1 fn__flex">
${genAVValueHTML(item.values[0])}
</div>
</div>`
})
})
element.innerHTML = html
})
}
</div>`;
});
});
element.innerHTML = html;
});
};

View file

@ -331,7 +331,7 @@ export const bindSelectEvent = (protyle: IProtyle, data: IAV, menuElement: HTMLE
if (!colData.options) {
colData.options = [];
}
const listElement = menuElement.lastElementChild.lastElementChild as HTMLElement
const listElement = menuElement.lastElementChild.lastElementChild as HTMLElement;
inputElement.addEventListener("input", (event: InputEvent) => {
if (event.isComposing) {
return;