diff --git a/apps/client/src/widgets/note_list.ts b/apps/client/src/widgets/note_list.ts index c49e4870c..81a818bdb 100644 --- a/apps/client/src/widgets/note_list.ts +++ b/apps/client/src/widgets/note_list.ts @@ -1,8 +1,10 @@ import NoteContextAwareWidget from "./note_context_aware_widget.js"; import NoteListRenderer from "../services/note_list_renderer.js"; import type FNote from "../entities/fnote.js"; -import type { CommandListener, CommandListenerData, EventData } from "../components/app_context.js"; +import type { CommandListener, CommandListenerData, CommandMappings, CommandNames, EventData } from "../components/app_context.js"; import type ViewMode from "./view_widgets/view_mode.js"; +import AttributeDetailWidget from "./attribute_widgets/attribute_detail.js"; +import { Attribute } from "../services/attribute_parser.js"; const TPL = /*html*/`
@@ -37,6 +39,14 @@ export default class NoteListWidget extends NoteContextAwareWidget { private noteIdRefreshed?: string; private shownNoteId?: string | null; private viewMode?: ViewMode | null; + private attributeDetailWidget: AttributeDetailWidget; + + constructor() { + super(); + this.attributeDetailWidget = new AttributeDetailWidget() + .contentSized() + .setParent(this); + } isEnabled() { return super.isEnabled() && this.noteContext?.hasNoteList(); @@ -46,6 +56,7 @@ export default class NoteListWidget extends NoteContextAwareWidget { this.$widget = $(TPL); this.contentSized(); this.$content = this.$widget.find(".note-list-widget-content"); + this.$widget.append(this.attributeDetailWidget.render()); const observer = new IntersectionObserver( (entries) => { @@ -64,6 +75,23 @@ export default class NoteListWidget extends NoteContextAwareWidget { setTimeout(() => observer.observe(this.$widget[0]), 10); } + addNoteListItemEvent() { + const attr: Attribute = { + type: "label", + name: "label:myLabel", + value: "promoted,single,text" + }; + + this.attributeDetailWidget!.showAttributeDetail({ + attribute: attr, + allAttributes: [ attr ], + isOwned: true, + x: 100, + y: 200, + focus: "name" + }); + } + checkRenderStatus() { // console.log("this.isIntersecting", this.isIntersecting); // console.log(`${this.noteIdRefreshed} === ${this.noteId}`, this.noteIdRefreshed === this.noteId); diff --git a/apps/client/src/widgets/view_widgets/table_view/index.ts b/apps/client/src/widgets/view_widgets/table_view/index.ts index 6297bcde0..0b6641612 100644 --- a/apps/client/src/widgets/view_widgets/table_view/index.ts +++ b/apps/client/src/widgets/view_widgets/table_view/index.ts @@ -8,6 +8,7 @@ import server from "../../../services/server.js"; import type { GridApi, GridState } from "ag-grid-community"; import SpacedUpdate from "../../../services/spaced_update.js"; import branches from "../../../services/branches.js"; +import type { CommandListenerData } from "../../../components/app_context.js"; const TPL = /*html*/`
@@ -33,6 +34,10 @@ const TPL = /*html*/` } +
+ +
+
`; @@ -158,5 +163,17 @@ export default class TableView extends ViewMode { }; return config; } + + async saveAttributesCommand() { + console.log("Save attributes"); + } + + async reloadAttributesCommand() { + console.log("Reload attributes"); + } + + async updateAttributeListCommand({ attributes }: CommandListenerData<"updateAttributeList">) { + console.log("Update attributes", { attributes }); + } } diff --git a/apps/client/src/widgets/view_widgets/view_mode.ts b/apps/client/src/widgets/view_widgets/view_mode.ts index caa107da9..c3552e020 100644 --- a/apps/client/src/widgets/view_widgets/view_mode.ts +++ b/apps/client/src/widgets/view_widgets/view_mode.ts @@ -1,6 +1,8 @@ import type { EventData } from "../../components/app_context.js"; +import Component from "../../components/component.js"; import type FNote from "../../entities/fnote.js"; import type { ViewTypeOptions } from "../../services/note_list_renderer.js"; +import type NoteListWidget from "../note_list.js"; import ViewModeStorage from "./view_mode_storage.js"; export interface ViewModeArgs { @@ -10,13 +12,14 @@ export interface ViewModeArgs { showNotePath?: boolean; } -export default abstract class ViewMode { +export default abstract class ViewMode extends Component { private _viewStorage: ViewModeStorage | null; protected parentNote: FNote; protected viewType: ViewTypeOptions; constructor(args: ViewModeArgs, viewType: ViewTypeOptions) { + super(); this.parentNote = args.parentNote; this._viewStorage = null; // note list must be added to the DOM immediately, otherwise some functionality scripting (canvas) won't work