mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🚨
This commit is contained in:
parent
84884aa6f3
commit
5cbfc5ecb3
4 changed files with 21 additions and 22 deletions
|
|
@ -37,7 +37,7 @@ export const getCellValue = (colType: TAVCol, value: string) => {
|
|||
};
|
||||
}
|
||||
return cellValue;
|
||||
}
|
||||
};
|
||||
|
||||
export const setFilter = (options: {
|
||||
filter: IAVFilter,
|
||||
|
|
@ -55,7 +55,7 @@ export const setFilter = (options: {
|
|||
column: options.filter.column,
|
||||
value: cellValue,
|
||||
operator: (window.siyuan.menus.menu.element.querySelector(".b3-select") as HTMLSelectElement).value as TAVFilterOperator
|
||||
}
|
||||
};
|
||||
|
||||
let isSame = false;
|
||||
options.data.view.filters.find((filter, index) => {
|
||||
|
|
@ -92,7 +92,7 @@ export const setFilter = (options: {
|
|||
return;
|
||||
}
|
||||
let selectHTML = "";
|
||||
let colData: IAVColumn
|
||||
let colData: IAVColumn;
|
||||
switch (colType) {
|
||||
case "text":
|
||||
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
||||
|
|
@ -293,21 +293,21 @@ export const getFiltersHTML = (data: IAVTable) => {
|
|||
let filterHTML = "";
|
||||
data.columns.find((item) => {
|
||||
if (item.id === filter.column) {
|
||||
let filterValue = ""
|
||||
let filterValue = "";
|
||||
if (filter.operator === "Is empty") {
|
||||
filterValue = ": " + window.siyuan.languages.filterOperatorIsEmpty
|
||||
filterValue = ": " + window.siyuan.languages.filterOperatorIsEmpty;
|
||||
} else if (filter.operator === "Is not empty") {
|
||||
filterValue = ": " + window.siyuan.languages.filterOperatorIsNotEmpty
|
||||
filterValue = ": " + window.siyuan.languages.filterOperatorIsNotEmpty;
|
||||
} else if (filter.value?.number?.content && ["=", "!=", ">", "<", ">=", "<="].includes(filter.operator)) {
|
||||
filterValue = ` ${filter.operator} ${filter.value.number.content}`
|
||||
filterValue = ` ${filter.operator} ${filter.value.number.content}`;
|
||||
} else if (filter.value?.text?.content && ["=", "Contains"].includes(filter.operator)) {
|
||||
filterValue = `: ${filter.value.text.content}`
|
||||
filterValue = `: ${filter.value.text.content}`;
|
||||
} else if (filter.value?.text?.content && ["!=", "Does not contains"].includes(filter.operator)) {
|
||||
filterValue = `Not ${filter.value.text.content}`
|
||||
filterValue = `Not ${filter.value.text.content}`;
|
||||
} else if (filter.value?.text?.content && "Starts with" === filter.operator) {
|
||||
filterValue = `: ${window.siyuan.languages.filterOperatorStartsWith} ${filter.value.text.content}`
|
||||
filterValue = `: ${window.siyuan.languages.filterOperatorStartsWith} ${filter.value.text.content}`;
|
||||
} else if (filter.value?.text?.content && "Ends with" === filter.operator) {
|
||||
filterValue = `: ${window.siyuan.languages.filterOperatorEndsWith} ${filter.value.text.content}`
|
||||
filterValue = `: ${window.siyuan.languages.filterOperatorEndsWith} ${filter.value.text.content}`;
|
||||
}
|
||||
filterHTML += `<span data-type="setFilter" class="b3-chip${filterValue ? " b3-chip--primary" : ""}">
|
||||
<svg><use xlink:href="#${getColIconByType(item.type)}"></use></svg>
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ export const openMenuPanel = (protyle: IProtyle,
|
|||
});
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "newCol") {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ ${column.wrap ? "" : "white-space: nowrap;"}">
|
|||
if (data.columns[index].hidden) {
|
||||
return;
|
||||
}
|
||||
let text = '';
|
||||
let text = "";
|
||||
if (cell.valueType === "text") {
|
||||
text = `<span class="av__celltext">${cell.value?.text.content || ""}</span>`;
|
||||
} else if (cell.valueType === "block") {
|
||||
|
|
@ -66,7 +66,7 @@ ${column.wrap ? "" : "white-space: nowrap;"}">
|
|||
text += `<span class="av__celltext"><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></span>`;
|
||||
});
|
||||
if (!text) {
|
||||
text = '<span class="av__celltext"></span>'
|
||||
text = '<span class="av__celltext"></span>';
|
||||
}
|
||||
} else if (cell.valueType === "date") {
|
||||
text = `<span class="av__celltext">${cell.value?.date.content || ""}</span>`;
|
||||
|
|
@ -80,13 +80,13 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;
|
|||
});
|
||||
tableHTML += "<div></div></div>";
|
||||
});
|
||||
let tabHTML = ""
|
||||
let tabHTML = "";
|
||||
response.data.views.forEach((item: IAVView) => {
|
||||
tabHTML += `<div data-id="${response.data.viewID}" class="item${item.id === response.data.viewID ? " item--focus" : ""}">
|
||||
<svg class="item__graphic"><use xlink:href="#iconTable"></use></svg>
|
||||
<span class="item__text">${item.name}</span>
|
||||
</div>`
|
||||
})
|
||||
</div>`;
|
||||
});
|
||||
const paddingLeft = e.parentElement.style.paddingLeft;
|
||||
const paddingRight = e.parentElement.style.paddingRight;
|
||||
e.style.width = e.parentElement.clientWidth + "px";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import {Menu} from "../../../plugin/Menu";
|
|||
import {transaction} from "../../wysiwyg/transaction";
|
||||
import {hasClosestByClassName} from "../../util/hasClosest";
|
||||
import {confirmDialog} from "../../../dialog/confirmDialog";
|
||||
import {setPosition} from "../../../util/setPosition";
|
||||
import {upDownHint} from "../../../util/upDownHint";
|
||||
|
||||
const filterSelectHTML = (key: string, options: { name: string, color: string }[]) => {
|
||||
|
|
@ -98,7 +97,7 @@ export const removeSelectCell = (protyle: IProtyle, data: IAVTable, options: {
|
|||
[colData.type]: oldValue
|
||||
}
|
||||
}]);
|
||||
}
|
||||
};
|
||||
|
||||
export const setSelectCol = (protyle: IProtyle, data: IAVTable, options: {
|
||||
cellElement: HTMLElement;
|
||||
|
|
@ -215,7 +214,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAVTable, options: {
|
|||
});
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
menuElement.innerHTML = getSelectHTML(data, options);
|
||||
bindSelectEvent(protyle, data, menuElement, options);
|
||||
});
|
||||
|
|
@ -229,7 +228,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAVTable, options: {
|
|||
label: `<span class="color__square" style="padding: 5px;margin: 2px;color: var(--b3-font-color${index + 1});background-color: var(--b3-font-background${index + 1});">A</span>`,
|
||||
click(element) {
|
||||
if (element.lastElementChild.classList.contains("b3-menu__accelerator")) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
element.parentElement.querySelector(".b3-menu__accelerator")?.remove();
|
||||
element.insertAdjacentHTML("beforeend", '<span class="b3-menu__accelerator"><svg class="svg" style="height: 30px; float: left;"><use xlink:href="#iconSelect"></use></svg></span>');
|
||||
|
|
@ -433,7 +432,7 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAVTable, options:
|
|||
if (colData.type === "select") {
|
||||
menuElement.parentElement.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const getSelectHTML = (data: IAVTable, options: { cellElement: HTMLElement }) => {
|
||||
const cellId = options.cellElement.dataset.id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue