feat(views/table): drag handle to avoid editing issues

This commit is contained in:
Elian Doran 2025-07-13 14:24:12 +03:00
parent 8cced607eb
commit adfdc7edb4
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { RelationEditor } from "./relation_editor.js"; import { RelationEditor } from "./relation_editor.js";
import { NoteFormatter, NoteTitleFormatter } from "./formatters.js"; import { NoteFormatter, NoteTitleFormatter, RowNumberFormatter } from "./formatters.js";
import { applyHeaderMenu } from "./header-menu.js"; import { applyHeaderMenu } from "./header-menu.js";
import type { ColumnDefinition } from "tabulator-tables"; import type { ColumnDefinition } from "tabulator-tables";
import { LabelType } from "../../../services/promoted_attribute_definition_parser.js"; import { LabelType } from "../../../services/promoted_attribute_definition_parser.js";
@ -46,11 +46,12 @@ export function buildColumnDefinitions(info: PromotedAttributeInformation[], exi
const columnDefs: ColumnDefinition[] = [ const columnDefs: ColumnDefinition[] = [
{ {
title: "#", title: "#",
formatter: "rownum",
headerSort: false, headerSort: false,
hozAlign: "center", hozAlign: "center",
resizable: false, resizable: false,
frozen: true frozen: true,
rowHandle: true,
formatter: RowNumberFormatter
}, },
{ {
field: "noteId", field: "noteId",
@ -79,6 +80,7 @@ export function buildColumnDefinitions(info: PromotedAttributeInformation[], exi
field, field,
title: title ?? name, title: title ?? name,
editor: "input", editor: "input",
rowHandle: false,
...labelTypeMappings[type ?? "text"], ...labelTypeMappings[type ?? "text"],
}); });
seenFields.add(field); seenFields.add(field);

View File

@ -36,6 +36,10 @@ export function NoteTitleFormatter(cell: CellComponent) {
return $noteRef[0].outerHTML; return $noteRef[0].outerHTML;
} }
export function RowNumberFormatter(cell: CellComponent) {
return `<span class="bx bx-dots-vertical-rounded"></span> ` + cell.getRow().getPosition(true);
}
function buildNoteLink(noteId: string) { function buildNoteLink(noteId: string) {
const $noteRef = $("<span>"); const $noteRef = $("<span>");
const href = `#root/${noteId}`; const href = `#root/${noteId}`;