MCPcopy Create free account
hub / github.com/microsoft/SandDance / _SandDanceReact

Function _SandDanceReact

docs/app/js/sanddance-app.js:11200–11242  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

11198 };
11199}
11200function _SandDanceReact(props) {
11201 class __SandDanceReact extends (0, _base.base).react.Component {
11202 layout() {
11203 this.lastData = this.props.data;
11204 this.viewer.render(this.props.insight, this.props.data, this.props.renderOptions).then((renderResult)=>{
11205 //TODO: show errors if any
11206 //console.log('viewer render');
11207 this.props.onView && this.props.onView(renderResult);
11208 }).catch((e)=>{
11209 //console.log('viewer error');
11210 this.props.onError && this.props.onError(e);
11211 });
11212 }
11213 view() {
11214 if (this.props.insight && this.props.data) {
11215 const c = compareProps(this.viewer, this.props.insight);
11216 const sameDataRef = this.props.data === this.lastData;
11217 if (!c.compare || !sameDataRef) this.layout();
11218 }
11219 }
11220 componentDidMount() {
11221 const element = (0, _base.base).reactDOM.findDOMNode(this.viewerDiv);
11222 this.viewer = new (0, _sanddance.Viewer)(element, this.props.viewerOptions);
11223 if (this.props.onMount) {
11224 if (this.props.onMount(this.viewer.presenter.getElement((0, _sanddance.VegaDeckGl).PresenterElement.gl))) this.view();
11225 } else this.view();
11226 }
11227 componentDidUpdate() {
11228 this.viewer.options = (0, _sanddance.VegaDeckGl).util.deepMerge(this.viewer.options, this.props.viewerOptions);
11229 this.view();
11230 }
11231 componentWillUnmount() {
11232 this.viewer.finalize();
11233 }
11234 render() {
11235 return (0, _base.base).react.createElement("div", {
11236 className: "sanddance-ReactViewer",
11237 ref: (div)=>this.viewerDiv = div
11238 });
11239 }
11240 }
11241 return new __SandDanceReact(props);
11242}
11243const SandDanceReact = _SandDanceReact;
11244
11245},{"./base":"anbmZ","./util":"4RaV2","@msrvida/sanddance":"69nA6","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"anbmZ":[function(require,module,exports) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected