@alilc/lowcode-shell
Version:
Shell Layer for AliLowCodeEngine
82 lines • 2.6 kB
JavaScript
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _createClass from "@babel/runtime/helpers/createClass";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import { windowSymbol } from '../symbols';
import { Resource as ShellResource } from './resource';
import { EditorView } from './editor-view';
export var Window = /*#__PURE__*/function () {
function Window(editorWindow) {
this[windowSymbol] = void 0;
this[windowSymbol] = editorWindow;
}
var _proto = Window.prototype;
_proto.importSchema = function importSchema(schema) {
this[windowSymbol].importSchema(schema);
};
_proto.changeViewType = function changeViewType(viewName) {
this[windowSymbol].changeViewName(viewName, false);
};
_proto.onChangeViewType = function onChangeViewType(fun) {
return this[windowSymbol].onChangeViewType(fun);
};
_proto.save = /*#__PURE__*/function () {
var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this[windowSymbol].save();
case 2:
return _context.abrupt("return", _context.sent);
case 3:
case "end":
return _context.stop();
}
}, _callee, this);
}));
function save() {
return _save.apply(this, arguments);
}
return save;
}();
_proto.onSave = function onSave(fn) {
return this[windowSymbol].onSave(fn);
};
return _createClass(Window, [{
key: "id",
get: function get() {
var _this$windowSymbol;
return (_this$windowSymbol = this[windowSymbol]) === null || _this$windowSymbol === void 0 ? void 0 : _this$windowSymbol.id;
}
}, {
key: "title",
get: function get() {
return this[windowSymbol].title;
}
}, {
key: "icon",
get: function get() {
return this[windowSymbol].icon;
}
}, {
key: "resource",
get: function get() {
return new ShellResource(this[windowSymbol].resource);
}
}, {
key: "currentEditorView",
get: function get() {
if (this[windowSymbol]._editorView) {
return new EditorView(this[windowSymbol]._editorView).toProxy();
}
return null;
}
}, {
key: "editorViews",
get: function get() {
return Array.from(this[windowSymbol].editorViews.values()).map(function (d) {
return new EditorView(d).toProxy();
});
}
}]);
}();