'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['authoring-common'], function (AuthoringCommon) { var SchematicEditor = AuthoringCommon.SchematicEditor; var dialogWrapper = AuthoringCommon.DialogWrapper; return function () { function SchematicEditorUI() { _classCallCheck(this, SchematicEditorUI); } SchematicEditorUI.openSchematicEditor = function openSchematicEditor(metadata) { if (!metadata) { return; } var resolve = void 0, reject = void 0, data = void 0; var promise = new Promise(function (_resolve, _reject) { resolve = _resolve; reject = _reject; }); var _okCallbackFn = function _okCallbackFn(_editorResponse) { // save the data which we're going to return data = _editorResponse; }; var _onCloseDialog = function _onCloseDialog() { // if when we close the dialog we have data // the data is to be resolved return data ? resolve(data) : reject(); }; var _onOpenDialog = function _onOpenDialog(_schematicEditorRef) { if (_schematicEditorRef) _schematicEditorRef.openDialog(); }; dialogWrapper.show(SchematicEditor, { definition: metadata, okCallbackFn: _okCallbackFn, onCloseDialog: _onCloseDialog, ref: _onOpenDialog }); return promise; }; return SchematicEditorUI; }(); }); //# sourceMappingURL=SchematicEditorUI.js.map