@kieler/klighd-core
Version:
Core KLighD diagram visualization with Sprotty
91 lines • 4.18 kB
JavaScript
;
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2021-2023 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptionsPanel = void 0;
const sprotty_1 = require("sprotty"); // eslint-disable-line @typescript-eslint/no-unused-vars
const inversify_1 = require("inversify");
const options_registry_1 = require("./options-registry");
const options_renderer_1 = require("./options-renderer");
const di_symbols_1 = require("../di.symbols");
const feather_icons_snabbdom_1 = require("../feather-icons-snabbdom/feather-icons-snabbdom");
const sidebar_1 = require("../sidebar");
const sidebar_panel_1 = require("../sidebar/sidebar-panel");
/** Sidebar panel that displays server provided KLighD options. */
let OptionsPanel = class OptionsPanel extends sidebar_1.SidebarPanel {
constructor() {
super(...arguments);
// sets this panel at the top position
// hierarchy is: first elem has the lowest number. so the last one got the highest
this.position = -10; // --> first position (at the moment)
}
init() {
this.optionsRegistry.onChange(() => this.update());
this.renderOptionsRegistry.onChange(() => this.update());
this.assignQuickActions();
}
update() {
super.assignQuickActions();
super.update();
}
get id() {
return 'options-panel';
}
get title() {
return 'Options';
}
render() {
return this.optionsRegistry.hasOptions() ? ((0, sprotty_1.html)("div", null,
(0, sprotty_1.html)(sidebar_panel_1.QuickActionsBar, { quickActions: this.getQuickActions(), onChange: this.handleQuickActionClick.bind(this), thisSidebarPanel: this }),
this.optionsRenderer.renderServerOptions({
actions: this.optionsRegistry.displayedActions,
layoutOptions: this.optionsRegistry.layoutOptions,
synthesisOptions: this.optionsRegistry.valuedSynthesisOptions,
}))) : ((0, sprotty_1.html)("span", null, "No options provided by the diagram server."));
}
get icon() {
return (0, sprotty_1.html)(feather_icons_snabbdom_1.FeatherIcon, { iconId: 'sliders' });
}
};
exports.OptionsPanel = OptionsPanel;
__decorate([
(0, inversify_1.inject)(di_symbols_1.DISymbol.OptionsRegistry),
__metadata("design:type", options_registry_1.OptionsRegistry)
], OptionsPanel.prototype, "optionsRegistry", void 0);
__decorate([
(0, inversify_1.inject)(di_symbols_1.DISymbol.OptionsRenderer),
__metadata("design:type", options_renderer_1.OptionsRenderer)
], OptionsPanel.prototype, "optionsRenderer", void 0);
__decorate([
(0, inversify_1.postConstruct)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], OptionsPanel.prototype, "init", null);
exports.OptionsPanel = OptionsPanel = __decorate([
(0, inversify_1.injectable)()
], OptionsPanel);
//# sourceMappingURL=options-panel.js.map