UNPKG

3.02 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 }
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16/*-----------------------------------------------------------------------------
17| Copyright (c) 2014-2017, PhosphorJS Contributors
18|
19| Distributed under the terms of the BSD 3-Clause License.
20|
21| The full license is in the file LICENSE, distributed with this software.
22|----------------------------------------------------------------------------*/
23var signaling_1 = require("@phosphor/signaling");
24var panel_1 = require("./panel");
25var stackedlayout_1 = require("./stackedlayout");
26/**
27 * A panel where visible widgets are stacked atop one another.
28 *
29 * #### Notes
30 * This class provides a convenience wrapper around a [[StackedLayout]].
31 */
32var StackedPanel = /** @class */ (function (_super) {
33 __extends(StackedPanel, _super);
34 /**
35 * Construct a new stacked panel.
36 *
37 * @param options - The options for initializing the panel.
38 */
39 function StackedPanel(options) {
40 if (options === void 0) { options = {}; }
41 var _this = _super.call(this, { layout: Private.createLayout(options) }) || this;
42 _this._widgetRemoved = new signaling_1.Signal(_this);
43 _this.addClass('p-StackedPanel');
44 return _this;
45 }
46 Object.defineProperty(StackedPanel.prototype, "widgetRemoved", {
47 /**
48 * A signal emitted when a widget is removed from a stacked panel.
49 */
50 get: function () {
51 return this._widgetRemoved;
52 },
53 enumerable: true,
54 configurable: true
55 });
56 /**
57 * A message handler invoked on a `'child-added'` message.
58 */
59 StackedPanel.prototype.onChildAdded = function (msg) {
60 msg.child.addClass('p-StackedPanel-child');
61 };
62 /**
63 * A message handler invoked on a `'child-removed'` message.
64 */
65 StackedPanel.prototype.onChildRemoved = function (msg) {
66 msg.child.removeClass('p-StackedPanel-child');
67 this._widgetRemoved.emit(msg.child);
68 };
69 return StackedPanel;
70}(panel_1.Panel));
71exports.StackedPanel = StackedPanel;
72/**
73 * The namespace for the module implementation details.
74 */
75var Private;
76(function (Private) {
77 /**
78 * Create a stacked layout for the given panel options.
79 */
80 function createLayout(options) {
81 return options.layout || new stackedlayout_1.StackedLayout();
82 }
83 Private.createLayout = createLayout;
84})(Private || (Private = {}));