import { _ } from '../../locale'; import CommandService from '../CommandService'; import { ItemFlow, ListRenderer, OnClickEvent } from '../plugins/api/noteListType'; interface Props { note: { id: string; title: string; is_todo: number; todo_completed: number; }; item: { // index: number; size: { height: number; }; selected: boolean; }; } const renderer: ListRenderer = { id: 'compact', label: async () => _('Compact'), flow: ItemFlow.TopToBottom, itemSize: { width: 0, height: 34, }, dependencies: [ // 'item.index', 'item.selected', 'item.size.height', 'note.id', 'note.is_shared', 'note.is_todo', 'note.isWatched', 'note.title', 'note.todo_completed', 'note.todoStatusText', ], itemCss: // css ` &:before { content: ''; border-bottom: 1px solid var(--joplin-divider-color); width: 90%; position: absolute; bottom: 0; left: 5%; } > .content.-selected { background-color: var(--joplin-selected-color); } &:hover, &.-focus-visible > .content { background-color: var(--joplin-background-color-hover3); } > .content { display: flex; box-sizing: border-box; position: relative; width: 100%; padding-left: 16px; > .checkbox { display: flex; align-items: center; > input { margin: 0px 10px 1px 0px; } } > .title { font-family: var(--joplin-font-family); font-size: var(--joplin-font-size); text-decoration: none; color: var(--joplin-color); cursor: default; white-space: nowrap; flex: 1 1 0%; display: flex; align-items: center; overflow: hidden; > .watchedicon { display: none; padding-right: 4px; color: var(--joplin-color); } } } > .content.-shared { > .title { color: var(--joplin-color-warn3); } } > .content.-completed { > .title { opacity: 0.5; } } > .content.-watched { > .title { > .watchedicon { display: inline; } } } `, headerTemplate: // html ` `, onHeaderClick: async (event: OnClickEvent) => { const field = event.elementId === 'title' ? 'title' : 'user_updated_time'; void CommandService.instance().execute('toggleNotesSortOrderField', field); }, itemTemplate: // html `
{{#note.is_todo}}
{{/note.is_todo}}
{{note.title}}
`, onRenderNote: async (props: Props) => { return props; }, }; export default renderer;