diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss index ebba58a41..160b949b9 100644 --- a/app/src/assets/scss/business/_av.scss +++ b/app/src/assets/scss/business/_av.scss @@ -114,6 +114,10 @@ &__celltext { flex: 1; overflow: hidden; + + .b3-chip { + margin: 2px; + } } &__firstcol { diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index c4f070464..7a24a246a 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -12,7 +12,7 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => { html = ``; } else if (type === "number") { html = ``; - } else if (type === "select" && blockElement) { + } else if (["select", "mSelect"].includes(type) && blockElement) { openMenuPanel(protyle, blockElement, "select", {cellElement}); return; } diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index 091c4ec0b..f2251c5c1 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -187,7 +187,7 @@ export const setFilter = (options: { label: `` }); if (options.filter.value.type === "select" || options.filter.value.type === "mSelect") { - colData.options.forEach((option) => { + colData.options?.forEach((option) => { let icon = "iconUncheck" options.filter.value.mSelect.find((optionItem) => { if (optionItem.content === option.name) { diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index b89d71fa9..0d612a38b 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -63,10 +63,12 @@ ${column.wrap ? "" : "white-space: nowrap;"}"> text = `${cell.value?.number.content || ""}`; } else if (cell.valueType === "mSelect" || cell.valueType === "select") { cell.value?.mSelect?.forEach((item: { content: string, color: string }) => { - text += `${item.content}`; + text += `${item.content}`; }); if (!text) { text = ''; + } else { + text = `${text}`; } } else if (cell.valueType === "date") { text = `${cell.value?.date.content || ""}`; diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts index 8e2ebab63..1d68958ad 100644 --- a/app/src/protyle/render/av/select.ts +++ b/app/src/protyle/render/av/select.ts @@ -118,7 +118,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: { transaction(protyle, [{ action: "updateAttrViewColOption", id: colId, - parentID: data.id, + avID: data.id, data: { newColor: color, oldName: name, @@ -127,7 +127,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: { }], [{ action: "updateAttrViewColOption", id: colId, - parentID: data.id, + avID: data.id, data: { newColor: color, oldName: inputElement.value, @@ -238,7 +238,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: { transaction(protyle, [{ action: "updateAttrViewColOption", id: colId, - parentID: data.id, + avID: data.id, data: { oldName: name, newName: inputElement.value, @@ -248,7 +248,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: { }], [{ action: "updateAttrViewColOption", id: colId, - parentID: data.id, + avID: data.id, data: { oldName: inputElement.value, newName: name, @@ -389,6 +389,18 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: { value: genCellValue(colData.type, ""), valueType: colData.type } + } else { + let hasSelected = false + cellData.value.mSelect.find((item) => { + if (item.content === currentElement.dataset.name) { + hasSelected = true + return true; + } + }) + if (hasSelected) { + menuElement.querySelector("input").focus(); + return; + } } const oldValue = Object.assign([], cellData.value.mSelect); @@ -448,6 +460,10 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: { } if (colData.type === "select") { menuElement.parentElement.remove(); + } else { + menuElement.innerHTML = getSelectHTML(data.view, options); + bindSelectEvent(protyle, data, menuElement, options); + menuElement.querySelector("input").focus(); } };