import linkService from "./link.js"; import noteContentRenderer from "./note_content_renderer.js"; import froca from "./froca.js"; import attributeRenderer from "./attribute_renderer.js"; const TPL = `
`; class NoteListRenderer { /* * We're using noteIds so that it's not necessary to load all notes at once when paging */ constructor($parent, parentNote, noteIds, showNotePath = false) { this.$noteList = $(TPL); // note list must be added to the DOM immediatelly, otherwise some functionality scripting (canvas) won't work $parent.empty(); this.parentNote = parentNote; const includedNoteIds = this.getIncludedNoteIds(); this.noteIds = noteIds.filter(noteId => !includedNoteIds.has(noteId)); if (this.noteIds.length === 0) { return; } $parent.append(this.$noteList); this.page = 1; this.pageSize = parseInt(parentNote.getLabelValue('pageSize')); if (!this.pageSize || this.pageSize < 1) { this.pageSize = 20; } this.viewType = parentNote.getLabelValue('viewType'); if (!['list', 'grid'].includes(this.viewType)) { // when not explicitly set decide based on note type this.viewType = parentNote.type === 'search' ? 'list' : 'grid'; } this.$noteList.addClass(this.viewType + '-view'); this.showNotePath = showNotePath; } /** @return {Set