UNPKG

4.93 kBTypeScriptView Raw
1import { Cell } from '@jupyterlab/cells';
2import { WindowedLayout, WindowedList, WindowedListModel } from '@jupyterlab/ui-components';
3import { Message } from '@lumino/messaging';
4import { Widget } from '@lumino/widgets';
5/**
6 * Notebook view model for the windowed list.
7 */
8export declare class NotebookViewModel extends WindowedListModel {
9 protected cells: Cell[];
10 /**
11 * Default cell height
12 */
13 static DEFAULT_CELL_SIZE: number;
14 /**
15 * Default editor line height
16 */
17 static DEFAULT_EDITOR_LINE_HEIGHT: number;
18 /**
19 * Default cell margin (top + bottom)
20 */
21 static DEFAULT_CELL_MARGIN: number;
22 /**
23 * Construct a notebook windowed list model.
24 */
25 constructor(cells: Cell[], options?: WindowedList.IModelOptions);
26 /**
27 * Cell size estimator
28 *
29 * @param index Cell index
30 * @returns Cell height in pixels
31 */
32 estimateWidgetSize: (index: number) => number;
33 /**
34 * Render the cell at index.
35 *
36 * @param index Cell index
37 * @returns Cell widget
38 */
39 widgetRenderer: (index: number) => Widget;
40}
41/**
42 * Windowed list layout for the notebook.
43 */
44export declare class NotebookWindowedLayout extends WindowedLayout {
45 private _header;
46 private _footer;
47 /**
48 * Notebook's header
49 */
50 get header(): Widget | null;
51 set header(header: Widget | null);
52 /**
53 * Notebook widget's footer
54 */
55 get footer(): Widget | null;
56 set footer(footer: Widget | null);
57 /**
58 * Dispose the layout
59 * */
60 dispose(): void;
61 /**
62 * * A message handler invoked on a `'child-removed'` message.
63 * *
64 * @param widget - The widget to remove from the layout.
65 *
66 * #### Notes
67 * A widget is automatically removed from the layout when its `parent`
68 * is set to `null`. This method should only be invoked directly when
69 * removing a widget from a layout which has yet to be installed on a
70 * parent widget.
71 *
72 * This method does *not* modify the widget's `parent`.
73 */
74 removeWidget(widget: Widget): void;
75 /**
76 * Attach a widget to the parent's DOM node.
77 *
78 * @param index - The current index of the widget in the layout.
79 *
80 * @param widget - The widget to attach to the parent.
81 *
82 * #### Notes
83 * This method is called automatically by the panel layout at the
84 * appropriate time. It should not be called directly by user code.
85 *
86 * The default implementation adds the widgets's node to the parent's
87 * node at the proper location, and sends the appropriate attach
88 * messages to the widget if the parent is attached to the DOM.
89 *
90 * Subclasses may reimplement this method to control how the widget's
91 * node is added to the parent's node.
92 */
93 protected attachWidget(index: number, widget: Widget): void;
94 /**
95 * Detach a widget from the parent's DOM node.
96 *
97 * @param index - The previous index of the widget in the layout.
98 *
99 * @param widget - The widget to detach from the parent.
100 *
101 * #### Notes
102 * This method is called automatically by the panel layout at the
103 * appropriate time. It should not be called directly by user code.
104 *
105 * The default implementation removes the widget's node from the
106 * parent's node, and sends the appropriate detach messages to the
107 * widget if the parent is attached to the DOM.
108 *
109 * Subclasses may reimplement this method to control how the widget's
110 * node is removed from the parent's node.
111 */
112 protected detachWidget(index: number, widget: Widget): void;
113 /**
114 * Move a widget in the parent's DOM node.
115 *
116 * @param fromIndex - The previous index of the widget in the layout.
117 *
118 * @param toIndex - The current index of the widget in the layout.
119 *
120 * @param widget - The widget to move in the parent.
121 *
122 * #### Notes
123 * This method is called automatically by the panel layout at the
124 * appropriate time. It should not be called directly by user code.
125 *
126 * The default implementation moves the widget's node to the proper
127 * location in the parent's node and sends the appropriate attach and
128 * detach messages to the widget if the parent is attached to the DOM.
129 *
130 * Subclasses may reimplement this method to control how the widget's
131 * node is moved in the parent's node.
132 */
133 protected moveWidget(fromIndex: number, toIndex: number, widget: Widget): void;
134 protected onAfterAttach(msg: Message): void;
135 protected onBeforeDetach(msg: Message): void;
136 /**
137 * A message handler invoked on a `'child-removed'` message.
138 *
139 * @param msg Message
140 */
141 protected onChildRemoved(msg: Widget.ChildMessage): void;
142 private _findNearestChildBinarySearch;
143 private _willBeRemoved;
144 private _topHiddenCodeCells;
145}