@alilc/lowcode-shell
Version:
Shell Layer for AliLowCodeEngine
87 lines (86 loc) • 3.01 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.Window = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _symbols = require("../symbols");
var _resource = require("./resource");
var _editorView = require("./editor-view");
var Window = exports.Window = /*#__PURE__*/function () {
function Window(editorWindow) {
this[_symbols.windowSymbol] = void 0;
this[_symbols.windowSymbol] = editorWindow;
}
var _proto = Window.prototype;
_proto.importSchema = function importSchema(schema) {
this[_symbols.windowSymbol].importSchema(schema);
};
_proto.changeViewType = function changeViewType(viewName) {
this[_symbols.windowSymbol].changeViewName(viewName, false);
};
_proto.onChangeViewType = function onChangeViewType(fun) {
return this[_symbols.windowSymbol].onChangeViewType(fun);
};
_proto.save = /*#__PURE__*/function () {
var _save = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this[_symbols.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[_symbols.windowSymbol].onSave(fn);
};
return (0, _createClass2["default"])(Window, [{
key: "id",
get: function get() {
var _this$windowSymbol;
return (_this$windowSymbol = this[_symbols.windowSymbol]) === null || _this$windowSymbol === void 0 ? void 0 : _this$windowSymbol.id;
}
}, {
key: "title",
get: function get() {
return this[_symbols.windowSymbol].title;
}
}, {
key: "icon",
get: function get() {
return this[_symbols.windowSymbol].icon;
}
}, {
key: "resource",
get: function get() {
return new _resource.Resource(this[_symbols.windowSymbol].resource);
}
}, {
key: "currentEditorView",
get: function get() {
if (this[_symbols.windowSymbol]._editorView) {
return new _editorView.EditorView(this[_symbols.windowSymbol]._editorView).toProxy();
}
return null;
}
}, {
key: "editorViews",
get: function get() {
return Array.from(this[_symbols.windowSymbol].editorViews.values()).map(function (d) {
return new _editorView.EditorView(d).toProxy();
});
}
}]);
}();