MCPcopy Index your code
hub / github.com/microsoft/SandDance / render

Method render

python/jupyter-widget/src/widget.ts:53–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51 private wrapper?: React.DetailedReactHTMLElement<any, HTMLElement>;
52
53 render() {
54 const explorerProps: ExplorerProps = {
55 logoClickUrl: 'https://microsoft.github.io/SandDance/',
56 compactUI: true,
57 mounted: (explorer: Explorer_Class) => {
58 this.explorer = explorer;
59
60 // restore previous snapshots
61 const snapshots = this.model.get('snapshots');
62 this.explorer.setState({ snapshots });
63
64 this.model.on('change:data', this.data_changed, this);
65
66 // TODO
67 // avoid error
68 // LAYER_TEXT-characters-program Bad uniform project_uViewProjectionMatrix
69 setTimeout(() => {
70 this.data_changed();
71 }, 0);
72 },
73 snapshotProps: {
74 getTopActions: (snapshots: SandDance.types.Snapshot[]) => {
75 const items = [
76 {
77 key: 'saveAsWidgetState',
78 text: 'Save as Widget State',
79 disabled: snapshots.length === 0,
80 onClick: () => this.saveSnapshots(snapshots),
81 },
82 ];
83 return items;
84 },
85 },
86 systemInfoChildren: [
87 React.createElement('li', null, 'SandDance (Python) version: ', this.model.get('pyversion')),
88 React.createElement('li', null, 'SandDance Jupyter Widget version: ', MODULE_VERSION),
89 ],
90 };
91
92 this.wrapper = React.createElement(
93 'div',
94 {
95 style: {
96 width: this.model.get('width'),
97 height: this.model.get('height'),
98 },
99 },
100 [React.createElement(Explorer, { ...explorerProps, key: 'explorer-key' })],
101 );
102
103 ReactDOM.render(this.wrapper, this.el);
104
105 this.model.on('change:width', this.size_changed, this);
106 this.model.on('change:height', this.size_changed, this);
107 }
108
109 private saveSnapshots(snapshots: SandDance.types.Snapshot[]) {
110 this.model.set('snapshots', snapshots);

Callers

nothing calls this directly

Calls 4

data_changedMethod · 0.95
saveSnapshotsMethod · 0.95
getMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected