|
@@ -1,6 +1,7 @@
|
|
|
import { Panel, Widget } from '@phosphor/widgets';
|
|
|
-import * as React from 'react';
|
|
|
+import React, { useState } from 'react';
|
|
|
import { ReactWidget } from '@jupyterlab/apputils';
|
|
|
+import { IVariablesModel } from '../../model';
|
|
|
|
|
|
const SEARCH_ITEM = 'jp-Search-item';
|
|
|
|
|
@@ -8,11 +9,11 @@ export class VariablesSearch extends Panel {
|
|
|
scope: Widget;
|
|
|
search: Widget;
|
|
|
|
|
|
- constructor() {
|
|
|
+ constructor(model: any) {
|
|
|
super();
|
|
|
this.addClass('jp-DebuggerSidebarVariable-Search');
|
|
|
this.scope = new VariableScopeSearch();
|
|
|
- this.search = new VariableSearchInput();
|
|
|
+ this.search = new VariableSearchInput(model);
|
|
|
this.scope.addClass(SEARCH_ITEM);
|
|
|
this.search.addClass(SEARCH_ITEM);
|
|
|
this.addWidget(this.scope);
|
|
@@ -20,20 +21,34 @@ export class VariablesSearch extends Panel {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const SearchComponent = ({ model }: any) => {
|
|
|
+ const [state, setState] = useState('');
|
|
|
+ model.filter = state;
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <input
|
|
|
+ placeholder="Search..."
|
|
|
+ className="jp-DebuggerSidebarVariable-Search-input"
|
|
|
+ value={state}
|
|
|
+ onChange={e => {
|
|
|
+ setState(e.target.value);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
class VariableSearchInput extends ReactWidget {
|
|
|
- constructor() {
|
|
|
+ search: string;
|
|
|
+ model: IVariablesModel;
|
|
|
+ constructor(model: IVariablesModel) {
|
|
|
super();
|
|
|
+ this.model = model;
|
|
|
+ this.search = model.filter;
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- return (
|
|
|
- <div>
|
|
|
- <input
|
|
|
- placeholder="Search..."
|
|
|
- className="jp-DebuggerSidebarVariable-Search-input"
|
|
|
- />
|
|
|
- </div>
|
|
|
- );
|
|
|
+ return <SearchComponent model={this.model} />;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -41,13 +56,39 @@ class VariableScopeSearch extends ReactWidget {
|
|
|
constructor() {
|
|
|
super();
|
|
|
}
|
|
|
+ open: boolean = false;
|
|
|
+ menu: ReactWidget;
|
|
|
+ widget: Widget;
|
|
|
+
|
|
|
+ showMenu = function() {
|
|
|
+ this.open = !this.open;
|
|
|
+ if (this.open) {
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
render() {
|
|
|
return (
|
|
|
- <div>
|
|
|
- <span className="jp-DebuggerSidebarVariable-Scope-label">local</span>{' '}
|
|
|
+ <div onClick={() => this.showMenu()}>
|
|
|
+ <span className="jp-DebuggerSidebarVariable-Scope-label">local</span>
|
|
|
<span className="fa fa-caret-down"></span>
|
|
|
</div>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// namespace Internal {
|
|
|
+// export function createOptionsNode(): HTMLElement {
|
|
|
+// const optionsIcon = document.createElement('span');
|
|
|
+// optionsIcon.className = 'fa fa-caret-down';
|
|
|
+// const optionLabel = document.createElement('span');
|
|
|
+
|
|
|
+// const options = document.createElement('div');
|
|
|
+// options.title = 'Options';
|
|
|
+// optionLabel.innerText = 'local';
|
|
|
+// optionLabel.className = 'jp-DebuggerSidebarVariable-Scope-label';
|
|
|
+// options.appendChild(optionLabel);
|
|
|
+// options.appendChild(optionsIcon);
|
|
|
+// return options;
|
|
|
+// }
|
|
|
+// }
|