2021-03-28 22:24:24 +02:00
|
|
|
import FlexContainer from "../widgets/containers/flex_container.js";
|
2020-04-25 23:52:13 +02:00
|
|
|
import GlobalMenuWidget from "../widgets/global_menu.js";
|
|
|
|
import TabRowWidget from "../widgets/tab_row.js";
|
|
|
|
import TitleBarButtonsWidget from "../widgets/title_bar_buttons.js";
|
|
|
|
import StandardTopWidget from "../widgets/standard_top_widget.js";
|
2021-03-28 22:24:24 +02:00
|
|
|
import SidePaneContainer from "../widgets/containers/side_pane_container.js";
|
2020-04-25 23:52:13 +02:00
|
|
|
import NoteTreeWidget from "../widgets/note_tree.js";
|
2021-05-22 12:35:41 +02:00
|
|
|
import NoteContextCachingWidget from "../widgets/note_context_caching_widget.js";
|
2020-04-25 23:52:13 +02:00
|
|
|
import NotePathsWidget from "../widgets/note_paths.js";
|
|
|
|
import NoteTitleWidget from "../widgets/note_title.js";
|
2021-01-30 15:50:46 +01:00
|
|
|
import OwnedAttributeListWidget from "../widgets/type_property_widgets/owned_attribute_list.js";
|
2020-04-25 23:52:13 +02:00
|
|
|
import NoteTypeWidget from "../widgets/note_type.js";
|
|
|
|
import NoteActionsWidget from "../widgets/note_actions.js";
|
|
|
|
import NoteDetailWidget from "../widgets/note_detail.js";
|
2020-04-26 09:40:02 +02:00
|
|
|
import NoteInfoWidget from "../widgets/collapsible_widgets/note_info.js";
|
|
|
|
import CalendarWidget from "../widgets/collapsible_widgets/calendar.js";
|
|
|
|
import LinkMapWidget from "../widgets/collapsible_widgets/link_map.js";
|
|
|
|
import NoteRevisionsWidget from "../widgets/collapsible_widgets/note_revisions.js";
|
2020-09-07 23:35:41 +02:00
|
|
|
import SimilarNotesWidget from "../widgets/similar_notes.js";
|
2020-04-26 09:40:02 +02:00
|
|
|
import WhatLinksHereWidget from "../widgets/collapsible_widgets/what_links_here.js";
|
2020-04-25 23:52:13 +02:00
|
|
|
import SidePaneToggles from "../widgets/side_pane_toggles.js";
|
2020-06-18 08:56:23 +02:00
|
|
|
import EditedNotesWidget from "../widgets/collapsible_widgets/edited_notes.js";
|
2021-03-28 22:24:24 +02:00
|
|
|
import CollapsibleSectionContainer from "../widgets/containers/collapsible_section_container.js";
|
2021-01-30 15:50:46 +01:00
|
|
|
import PromotedAttributesWidget from "../widgets/type_property_widgets/promoted_attributes.js";
|
|
|
|
import InheritedAttributesWidget from "../widgets/type_property_widgets/inherited_attribute_list.js";
|
2020-11-25 23:18:30 +01:00
|
|
|
import NoteListWidget from "../widgets/note_list.js";
|
2021-01-30 15:50:46 +01:00
|
|
|
import SearchDefinitionWidget from "../widgets/type_property_widgets/search_definition.js";
|
2020-12-29 22:27:31 +01:00
|
|
|
import SqlResultWidget from "../widgets/sql_result.js";
|
|
|
|
import SqlTableSchemasWidget from "../widgets/sql_table_schemas.js";
|
2021-01-30 15:50:46 +01:00
|
|
|
import FilePropertiesWidget from "../widgets/type_property_widgets/file_properties.js";
|
2021-01-30 20:21:44 +01:00
|
|
|
import ImagePropertiesWidget from "../widgets/type_property_widgets/image_properties.js";
|
2021-01-31 12:15:36 +01:00
|
|
|
import NotePropertiesWidget from "../widgets/type_property_widgets/note_properties.js";
|
2021-02-13 20:07:08 +01:00
|
|
|
import NoteIconWidget from "../widgets/note_icon.js";
|
2021-02-19 22:15:56 +01:00
|
|
|
import SearchResultWidget from "../widgets/search_result.js";
|
2021-03-20 00:00:49 +01:00
|
|
|
import SyncStatusWidget from "../widgets/sync_status.js";
|
2021-03-28 22:24:24 +02:00
|
|
|
import ScrollingContainer from "../widgets/containers/scrolling_container.js";
|
|
|
|
import RootContainer from "../widgets/containers/root_container.js";
|
2021-04-24 21:56:44 +02:00
|
|
|
import NoteUpdateStatusWidget from "../widgets/note_update_status.js";
|
2021-05-17 21:46:18 +02:00
|
|
|
import SpacerWidget from "../widgets/spacer.js";
|
|
|
|
import QuickSearchWidget from "../widgets/quick_search.js";
|
2021-05-18 22:14:35 +02:00
|
|
|
import ButtonWidget from "../widgets/button_widget.js";
|
|
|
|
import ProtectedSessionStatusWidget from "../widgets/protected_session_status.js";
|
2021-05-19 22:45:34 +02:00
|
|
|
import PaneContainer from "../widgets/containers/pane_container.js";
|
2021-05-22 21:35:25 +02:00
|
|
|
import SidebarToggleWidget from "../widgets/sidebar_toggle.js";
|
2020-02-06 21:47:31 +01:00
|
|
|
|
2020-03-01 18:47:20 +01:00
|
|
|
const RIGHT_PANE_CSS = `
|
|
|
|
<style>
|
2020-03-07 14:18:58 +01:00
|
|
|
#right-pane {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
2020-03-01 18:47:20 +01:00
|
|
|
#right-pane .card {
|
|
|
|
border: 0;
|
|
|
|
display: flex;
|
2020-03-07 14:18:58 +01:00
|
|
|
flex-shrink: 0;
|
2020-03-01 18:47:20 +01:00
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .card-header {
|
|
|
|
background: inherit;
|
2021-01-30 21:28:10 +01:00
|
|
|
padding: 6px 10px 3px 0;
|
2020-03-01 18:47:20 +01:00
|
|
|
width: 99%; /* to give minimal right margin */
|
|
|
|
background-color: var(--button-background-color);
|
|
|
|
border-color: var(--button-border-color);
|
2020-09-24 21:58:00 +02:00
|
|
|
border-width: 0 0 1px 0;
|
2020-03-01 18:47:20 +01:00
|
|
|
border-radius: 4px;
|
|
|
|
border-style: solid;
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .widget-title {
|
|
|
|
border-radius: 0;
|
|
|
|
padding: 0;
|
|
|
|
border: 0;
|
|
|
|
background: inherit;
|
|
|
|
font-weight: bold;
|
|
|
|
text-transform: uppercase;
|
|
|
|
color: var(--muted-text-color) !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .widget-header-action {
|
|
|
|
cursor: pointer;
|
2020-10-15 20:37:55 +02:00
|
|
|
color: var(--main-text-color) !important;
|
|
|
|
text-decoration: none;
|
|
|
|
font-size: large;
|
|
|
|
position: relative;
|
|
|
|
top: 2px;
|
2020-03-01 18:47:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .widget-help {
|
|
|
|
color: var(--muted-text-color);
|
|
|
|
position: relative;
|
|
|
|
top: 2px;
|
2020-10-15 20:37:55 +02:00
|
|
|
font-size: large;
|
2020-03-01 18:47:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .widget-help.no-link:hover {
|
|
|
|
cursor: default;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
2020-10-12 23:15:53 +02:00
|
|
|
#right-pane .widget-toggle-button {
|
|
|
|
cursor: pointer;
|
|
|
|
color: var(--main-text-color) !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .widget-toggle-button:hover {
|
|
|
|
text-decoration: none !important;
|
|
|
|
}
|
|
|
|
|
2021-01-30 21:28:10 +01:00
|
|
|
#right-pane .widget-toggle-icon {
|
|
|
|
position: relative;
|
|
|
|
top: 2px;
|
|
|
|
font-size: large;
|
2021-02-13 21:52:31 +01:00
|
|
|
padding-left: 5px;
|
2021-01-30 21:28:10 +01:00
|
|
|
}
|
|
|
|
|
2020-03-01 18:47:20 +01:00
|
|
|
#right-pane .body-wrapper {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .card-body {
|
|
|
|
width: 100%;
|
|
|
|
padding: 8px;
|
|
|
|
border: 0;
|
|
|
|
height: 100%;
|
|
|
|
overflow: auto;
|
2020-03-07 20:41:03 +01:00
|
|
|
max-height: 300px;
|
2020-03-01 18:47:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#right-pane .card-body ul {
|
|
|
|
padding-left: 25px;
|
|
|
|
margin-bottom: 5px;
|
|
|
|
}
|
|
|
|
</style>`;
|
|
|
|
|
2021-03-21 23:05:31 +01:00
|
|
|
export default class DesktopLayout {
|
2020-03-16 21:16:09 +01:00
|
|
|
constructor(customWidgets) {
|
|
|
|
this.customWidgets = customWidgets;
|
|
|
|
}
|
|
|
|
|
2020-02-06 21:47:31 +01:00
|
|
|
getRootWidget(appContext) {
|
2020-05-02 00:28:40 +02:00
|
|
|
appContext.mainTreeWidget = new NoteTreeWidget("main");
|
2020-03-15 21:52:04 +01:00
|
|
|
|
2021-03-28 22:24:24 +02:00
|
|
|
return new RootContainer()
|
2020-02-27 12:26:42 +01:00
|
|
|
.setParent(appContext)
|
2021-05-18 22:14:35 +02:00
|
|
|
.child(new FlexContainer("column")
|
|
|
|
.child(new GlobalMenuWidget())
|
|
|
|
.child(new ButtonWidget()
|
|
|
|
.icon("bx-file-blank")
|
|
|
|
.title("New note")
|
|
|
|
.command("createNoteIntoInbox"))
|
|
|
|
.child(new ButtonWidget()
|
|
|
|
.icon("bx-search")
|
|
|
|
.title("Search")
|
|
|
|
.command("searchNotes"))
|
|
|
|
.child(new ButtonWidget()
|
|
|
|
.icon("bx-send")
|
|
|
|
.title("Jump to note")
|
|
|
|
.command("jumpToNote"))
|
|
|
|
.child(new ButtonWidget()
|
|
|
|
.icon("bx-history")
|
|
|
|
.title("Show recent changes")
|
|
|
|
.command("showRecentChanges"))
|
|
|
|
.child(new SpacerWidget())
|
|
|
|
.child(new ProtectedSessionStatusWidget())
|
|
|
|
.child(new SyncStatusWidget())
|
2021-05-22 21:35:25 +02:00
|
|
|
.child(new SidebarToggleWidget())
|
2021-05-18 22:14:35 +02:00
|
|
|
.css("width", "50px")
|
|
|
|
)
|
2021-05-17 21:46:18 +02:00
|
|
|
.child(new SidePaneContainer('left')
|
|
|
|
.hideInZenMode()
|
|
|
|
.css("width", "300px")
|
|
|
|
.child(new QuickSearchWidget())
|
|
|
|
.child(appContext.mainTreeWidget)
|
|
|
|
.child(...this.customWidgets.get('left-pane'))
|
|
|
|
)
|
|
|
|
.child(new FlexContainer('column')
|
|
|
|
.id('center-pane')
|
|
|
|
.css("flex-grow", "1")
|
|
|
|
.child(new FlexContainer('row').overflowing()
|
2021-05-18 22:14:35 +02:00
|
|
|
.child(new TabRowWidget())
|
2021-05-17 21:46:18 +02:00
|
|
|
.child(new TitleBarButtonsWidget())
|
|
|
|
.css('height', '36px')
|
2020-02-27 10:03:14 +01:00
|
|
|
)
|
2021-05-20 23:13:34 +02:00
|
|
|
.child(new PaneContainer(() =>
|
|
|
|
new FlexContainer('column')
|
|
|
|
.css("flex-grow", "1")
|
|
|
|
.child(new FlexContainer('row').class('title-row')
|
|
|
|
.css('align-items: center;')
|
|
|
|
.cssBlock('.title-row > * { margin: 5px; }')
|
|
|
|
.overflowing()
|
|
|
|
.child(new NoteIconWidget())
|
|
|
|
.child(new NoteTitleWidget())
|
|
|
|
.child(new NotePathsWidget().hideInZenMode())
|
|
|
|
.child(new NoteTypeWidget().hideInZenMode())
|
|
|
|
.child(new NoteActionsWidget().hideInZenMode())
|
|
|
|
.child(new ButtonWidget()
|
|
|
|
.icon("bx-window-open bx-rotate-90")
|
|
|
|
.title("Create new pane")
|
|
|
|
.command("openNewPane"))
|
2021-05-19 22:45:34 +02:00
|
|
|
)
|
2021-05-20 23:13:34 +02:00
|
|
|
.child(
|
|
|
|
new CollapsibleSectionContainer()
|
|
|
|
.child(new SearchDefinitionWidget())
|
|
|
|
.child(new NotePropertiesWidget())
|
|
|
|
.child(new FilePropertiesWidget())
|
|
|
|
.child(new ImagePropertiesWidget())
|
|
|
|
.child(new PromotedAttributesWidget())
|
|
|
|
.child(new OwnedAttributeListWidget())
|
|
|
|
.child(new InheritedAttributesWidget())
|
|
|
|
)
|
|
|
|
.child(new NoteUpdateStatusWidget())
|
|
|
|
.child(
|
|
|
|
new ScrollingContainer()
|
|
|
|
.child(new SqlTableSchemasWidget())
|
|
|
|
.child(new NoteDetailWidget())
|
|
|
|
.child(new NoteListWidget())
|
|
|
|
.child(new SearchResultWidget())
|
|
|
|
.child(new SqlResultWidget())
|
|
|
|
)
|
|
|
|
.child(new SimilarNotesWidget())
|
|
|
|
.child(...this.customWidgets.get('center-pane'))
|
2020-12-27 22:19:27 +01:00
|
|
|
)
|
2020-02-27 10:03:14 +01:00
|
|
|
)
|
|
|
|
);
|
2020-02-06 21:47:31 +01:00
|
|
|
}
|
2020-05-12 12:45:32 +02:00
|
|
|
}
|