mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
892b308d56
commit
44d0537f10
2 changed files with 29 additions and 9 deletions
|
|
@ -94,6 +94,7 @@ export const setFilter = (options: {
|
|||
return;
|
||||
}
|
||||
let selectHTML = "";
|
||||
let colData: IAVColumn
|
||||
switch (colType) {
|
||||
case "text":
|
||||
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
||||
|
|
@ -120,6 +121,7 @@ export const setFilter = (options: {
|
|||
case "mSelect":
|
||||
options.data.columns.find((column) => {
|
||||
if (column.id === options.filter.column) {
|
||||
colData = column;
|
||||
if (column.type === "select") {
|
||||
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
||||
<option ${"!=" === options.filter.operator ? "selected" : ""} value="!=">${window.siyuan.languages.filterOperatorIsNot}</option>
|
||||
|
|
@ -143,7 +145,15 @@ export const setFilter = (options: {
|
|||
label: `<select style="margin: 4px 0" class="b3-select fn__size200">${selectHTML}</select>`
|
||||
});
|
||||
if (colType === "mSelect") {
|
||||
// TODO
|
||||
colData.options.forEach((option) => {
|
||||
menu.addItem({
|
||||
label: `<input style="margin: 4px 0" value="${options.filter.value.text.content}" class="b3-text-field fn__size200">`,
|
||||
click() {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (colType === "text") {
|
||||
menu.addItem({
|
||||
iconHTML: "",
|
||||
|
|
@ -205,12 +215,12 @@ export const setFilter = (options: {
|
|||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (selectElement.value === "Is empty" || selectElement.value === "Is not empty") {
|
||||
selectElement.parentElement.parentElement.nextElementSibling.classList.add("fn__none");
|
||||
} else {
|
||||
selectElement.parentElement.parentElement.nextElementSibling.classList.remove("fn__none");
|
||||
}
|
||||
}
|
||||
menu.open({x: rectTarget.left, y: rectTarget.bottom});
|
||||
if (textElement) {
|
||||
textElement.select();
|
||||
|
|
|
|||
|
|
@ -368,6 +368,9 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {
|
|||
row.cells.find(cell => {
|
||||
if (cell.id === cellId) {
|
||||
cellData = cell;
|
||||
if (!cellData.value.mSelect) {
|
||||
cellData.value.mSelect = [];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
@ -376,10 +379,17 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {
|
|||
});
|
||||
|
||||
const oldValue = Object.assign([], cellData.value.mSelect);
|
||||
cellData.value.mSelect?.push({
|
||||
if (colData.type === "mSelect") {
|
||||
cellData.value.mSelect.push({
|
||||
color: currentElement.dataset.color,
|
||||
content: currentElement.dataset.name
|
||||
});
|
||||
} else {
|
||||
cellData.value.mSelect = [{
|
||||
color: currentElement.dataset.color,
|
||||
content: currentElement.dataset.name
|
||||
}];
|
||||
}
|
||||
|
||||
if (currentElement.querySelector(".b3-menu__accelerator")) {
|
||||
colData.options.push({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue