mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 19:08:56 +01:00
feat(board/relation): allow dragging between columns
This commit is contained in:
parent
ad6d61f1f7
commit
f90e0767cb
@ -22,6 +22,15 @@ export async function setLabel(noteId: string, name: string, value: string = "",
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function setRelation(noteId: string, name: string, value: string = "", isInheritable = false) {
|
||||||
|
await server.put(`notes/${noteId}/set-attribute`, {
|
||||||
|
type: "relation",
|
||||||
|
name: name,
|
||||||
|
value: value,
|
||||||
|
isInheritable
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function removeAttributeById(noteId: string, attributeId: string) {
|
async function removeAttributeById(noteId: string, attributeId: string) {
|
||||||
await server.remove(`notes/${noteId}/attributes/${attributeId}`);
|
await server.remove(`notes/${noteId}/attributes/${attributeId}`);
|
||||||
}
|
}
|
||||||
@ -116,6 +125,7 @@ function isAffecting(attrRow: AttributeRow, affectedNote: FNote | null | undefin
|
|||||||
export default {
|
export default {
|
||||||
addLabel,
|
addLabel,
|
||||||
setLabel,
|
setLabel,
|
||||||
|
setRelation,
|
||||||
setAttribute,
|
setAttribute,
|
||||||
removeAttributeById,
|
removeAttributeById,
|
||||||
removeOwnedLabelByName,
|
removeOwnedLabelByName,
|
||||||
|
|||||||
@ -12,15 +12,25 @@ import { ColumnMap } from "./data";
|
|||||||
|
|
||||||
export default class BoardApi {
|
export default class BoardApi {
|
||||||
|
|
||||||
|
private isRelationMode: boolean;
|
||||||
|
statusAttribute: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private byColumn: ColumnMap | undefined,
|
private byColumn: ColumnMap | undefined,
|
||||||
public columns: string[],
|
public columns: string[],
|
||||||
private parentNote: FNote,
|
private parentNote: FNote,
|
||||||
readonly statusAttribute: string,
|
statusAttribute: string,
|
||||||
private viewConfig: BoardViewData,
|
private viewConfig: BoardViewData,
|
||||||
private saveConfig: (newConfig: BoardViewData) => void,
|
private saveConfig: (newConfig: BoardViewData) => void,
|
||||||
private setBranchIdToEdit: (branchId: string | undefined) => void
|
private setBranchIdToEdit: (branchId: string | undefined) => void
|
||||||
) {};
|
) {
|
||||||
|
this.isRelationMode = statusAttribute.startsWith("~");
|
||||||
|
|
||||||
|
if (statusAttribute.startsWith("~") || statusAttribute.startsWith("#")) {
|
||||||
|
statusAttribute = statusAttribute.substring(1);
|
||||||
|
}
|
||||||
|
this.statusAttribute = statusAttribute;
|
||||||
|
};
|
||||||
|
|
||||||
async createNewItem(column: string, title: string) {
|
async createNewItem(column: string, title: string) {
|
||||||
try {
|
try {
|
||||||
@ -42,7 +52,11 @@ export default class BoardApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async changeColumn(noteId: string, newColumn: string) {
|
async changeColumn(noteId: string, newColumn: string) {
|
||||||
await attributes.setLabel(noteId, this.statusAttribute, newColumn);
|
if (this.isRelationMode) {
|
||||||
|
await attributes.setRelation(noteId, this.statusAttribute, newColumn);
|
||||||
|
} else {
|
||||||
|
await attributes.setLabel(noteId, this.statusAttribute, newColumn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async addNewColumn(columnName: string) {
|
async addNewColumn(columnName: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user