mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	feat(calendar): support displaying of attributes and realtions with multiple cardinality
This commit is contained in:
		
							parent
							
								
									6c1cb71c9f
								
							
						
					
					
						commit
						85917d7207
					
				@ -138,7 +138,7 @@ export default class CalendarView extends ViewMode {
 | 
			
		||||
 | 
			
		||||
                // Promoted attributes
 | 
			
		||||
                if (promotedAttributes) {
 | 
			
		||||
                    for (const [name, value] of Object.entries(promotedAttributes)) {
 | 
			
		||||
                    for (const [name, value] of promotedAttributes) {
 | 
			
		||||
                        html += `\
 | 
			
		||||
                        <div class="promoted-attribute">
 | 
			
		||||
                            <span class="promoted-attribute-name">${name}</span>: <span class="promoted-attribute-value">${value}</span>
 | 
			
		||||
@ -353,7 +353,7 @@ export default class CalendarView extends ViewMode {
 | 
			
		||||
        const events: EventInput[] = [];
 | 
			
		||||
 | 
			
		||||
        const calendarDisplayedAttributes = note.getLabelValue("calendar:displayedAttributes")?.split(",");
 | 
			
		||||
        let displayedAttributesData = null;
 | 
			
		||||
        let displayedAttributesData: Array<[string, string]> | null = null;
 | 
			
		||||
        if (calendarDisplayedAttributes) {
 | 
			
		||||
            displayedAttributesData = await this.#buildDisplayedAttributes(note, calendarDisplayedAttributes);
 | 
			
		||||
        }
 | 
			
		||||
@ -380,11 +380,11 @@ export default class CalendarView extends ViewMode {
 | 
			
		||||
 | 
			
		||||
    static async #buildDisplayedAttributes(note: FNote, calendarDisplayedAttributes: string[]) {
 | 
			
		||||
        const filteredDisplayedAttributes = note.getAttributes().filter((attr): boolean => calendarDisplayedAttributes.includes(attr.name))
 | 
			
		||||
        const result: Record<string, string> = {};
 | 
			
		||||
        const result: Array<[string, string]> = [];
 | 
			
		||||
 | 
			
		||||
        for (const attribute of filteredDisplayedAttributes) {
 | 
			
		||||
            if (attribute.type === "label") result[attribute.name] = attribute.value;
 | 
			
		||||
            else result[attribute.name] = (await attribute.getTargetNote())?.title || ""
 | 
			
		||||
            if (attribute.type === "label") result.push([attribute.name, attribute.value]);
 | 
			
		||||
            else result.push([attribute.name, (await attribute.getTargetNote())?.title || ""])
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user