SchematicEditorUI.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2020
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['authoring-common'], function (AuthoringCommon) {
  9. var SchematicEditor = AuthoringCommon.SchematicEditor;
  10. var dialogWrapper = AuthoringCommon.DialogWrapper;
  11. return function () {
  12. function SchematicEditorUI() {
  13. _classCallCheck(this, SchematicEditorUI);
  14. }
  15. SchematicEditorUI.openSchematicEditor = function openSchematicEditor(metadata) {
  16. if (!metadata) {
  17. return;
  18. }
  19. var resolve = void 0,
  20. reject = void 0,
  21. data = void 0;
  22. var promise = new Promise(function (_resolve, _reject) {
  23. resolve = _resolve;
  24. reject = _reject;
  25. });
  26. var _okCallbackFn = function _okCallbackFn(_editorResponse) {
  27. // save the data which we're going to return
  28. data = _editorResponse;
  29. };
  30. var _onCloseDialog = function _onCloseDialog() {
  31. // if when we close the dialog we have data
  32. // the data is to be resolved
  33. return data ? resolve(data) : reject();
  34. };
  35. var _onOpenDialog = function _onOpenDialog(_schematicEditorRef) {
  36. if (_schematicEditorRef) _schematicEditorRef.openDialog();
  37. };
  38. dialogWrapper.show(SchematicEditor, {
  39. definition: metadata,
  40. okCallbackFn: _okCallbackFn,
  41. onCloseDialog: _onCloseDialog,
  42. ref: _onOpenDialog
  43. });
  44. return promise;
  45. };
  46. return SchematicEditorUI;
  47. }();
  48. });
  49. //# sourceMappingURL=SchematicEditorUI.js.map