Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit a067d05

Browse files
committed
standalone working with upgraded js, jupyterlab extension not currenlty working with latest
1 parent 46f8d31 commit a067d05

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

scriptedforms/src/app/phosphor-angular-loader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from '@phosphor/widgets';
2121

2222
import {
23-
PromiseDelegate
23+
PromiseDelegate, UUID
2424
} from '@phosphor/coreutils';
2525

2626
import {
@@ -107,6 +107,7 @@ export class AngularWidget<C, M> extends Widget {
107107

108108
constructor(ngComponent: Type<C>, angularLoader: AngularLoader<M>, options?: Widget.IOptions) {
109109
super(options);
110+
console.log(`Created an Angular Widget ${UUID.uuid4()}`)
110111
angularLoader.loaderReady.promise
111112
.then(() => {
112113
this.ngZone = angularLoader.ngZone;
@@ -127,6 +128,7 @@ export class AngularWidget<C, M> extends Widget {
127128
}
128129

129130
dispose(): void {
131+
console.log('AngularWidget DISPOSED')
130132
this.ngZone.run(() => {
131133
this.componentRef.destroy();
132134
});

scriptedforms/src/app/widget.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ export class AngularWrapperWidget extends AngularWidget<
9696
}
9797
}
9898

99+
const sleep = (ms: number) => new Promise(_ => setTimeout(_, ms));
100+
99101
export class ScriptedFormsWidget extends Widget {
100102
_context: DocumentRegistry.Context;
101103
private _content: AngularWrapperWidget;
102-
toolbar = new Toolbar();
104+
private _toolbar: Toolbar
103105
id: 'ScriptedForms';
104106

105107
constructor(options: IScriptedFormsWidget.IOptions) {
@@ -112,12 +114,14 @@ export class ScriptedFormsWidget extends Widget {
112114
this.addClass('scripted-form-widget');
113115

114116
const layout = (this.layout = new BoxLayout());
115-
this.toolbar.addClass('jp-NotebookPanel-toolbar');
116-
this.toolbar.addClass('custom-toolbar');
117-
layout.addWidget(this.toolbar);
118-
BoxLayout.setStretch(this.toolbar, 0);
117+
const toolbar = new Toolbar();
118+
this._toolbar = toolbar;
119+
toolbar.addClass('jp-NotebookPanel-toolbar');
120+
toolbar.addClass('custom-toolbar');
121+
layout.addWidget(toolbar);
122+
BoxLayout.setStretch(toolbar, 0);
119123

120-
const angularWrapperWidgetOptions = Object.assign({ toolbar: this.toolbar }, options);
124+
const angularWrapperWidgetOptions = Object.assign({ toolbar }, options);
121125

122126
this._content = new AngularWrapperWidget(angularWrapperWidgetOptions);
123127
this._content.addClass('form-container');
@@ -126,12 +130,17 @@ export class ScriptedFormsWidget extends Widget {
126130
BoxLayout.setStretch(this._content, 1);
127131

128132
this._content.initiliseScriptedForms();
133+
// sleep(4000).then(() => {this._content.initiliseScriptedForms();});
129134
}
130135

131136
get content() {
132137
return this._content;
133138
}
134139

140+
get toolbar() {
141+
return this._toolbar;
142+
}
143+
135144
get revealed() {
136145
return Promise.resolve();
137146
}

0 commit comments

Comments
 (0)