1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.PanelView = void 0;
|
19 | var tslib_1 = require("tslib");
|
20 | var React = tslib_1.__importStar(require("react"));
|
21 | var common_1 = require("../../common");
|
22 | var buttons_1 = require("../button/buttons");
|
23 | var text_1 = require("../text/text");
|
24 | var PanelView = (function (_super) {
|
25 | tslib_1.__extends(PanelView, _super);
|
26 | function PanelView() {
|
27 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
28 | _this.handleClose = function () { return _this.props.onClose(_this.props.panel); };
|
29 | return _this;
|
30 | }
|
31 | PanelView.prototype.render = function () {
|
32 | var _a = this.props, panel = _a.panel, onOpen = _a.onOpen;
|
33 |
|
34 |
|
35 | return (React.createElement("div", { className: common_1.Classes.PANEL_STACK_VIEW },
|
36 | this.maybeRenderHeader(),
|
37 | React.createElement(panel.component, tslib_1.__assign({ openPanel: onOpen, closePanel: this.handleClose }, panel.props))));
|
38 | };
|
39 | PanelView.prototype.maybeRenderHeader = function () {
|
40 | if (!this.props.showHeader) {
|
41 | return null;
|
42 | }
|
43 | return (React.createElement("div", { className: common_1.Classes.PANEL_STACK_HEADER },
|
44 | React.createElement("span", null, this.maybeRenderBack()),
|
45 | React.createElement(text_1.Text, { className: common_1.Classes.HEADING, ellipsize: true, title: this.props.panel.htmlTitle }, this.props.panel.title),
|
46 | React.createElement("span", null)));
|
47 | };
|
48 | PanelView.prototype.maybeRenderBack = function () {
|
49 | if (this.props.previousPanel === undefined) {
|
50 | return null;
|
51 | }
|
52 | return (React.createElement(buttons_1.Button, { "aria-label": "Back", className: common_1.Classes.PANEL_STACK_HEADER_BACK, icon: "chevron-left", minimal: true, onClick: this.handleClose, small: true, text: this.props.previousPanel.title, title: this.props.previousPanel.htmlTitle }));
|
53 | };
|
54 | return PanelView;
|
55 | }(common_1.AbstractPureComponent2));
|
56 | exports.PanelView = PanelView;
|
57 |
|
\ | No newline at end of file |