@hpcc-js/phosphor 2.16.0 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  })(this, (function (exports, common) { 'use strict';
6
6
 
7
7
  var PKG_NAME = "@hpcc-js/phosphor";
8
- var PKG_VERSION = "2.16.0";
9
- var BUILD_VERSION = "2.104.1";
8
+ var PKG_VERSION = "2.16.2";
9
+ var BUILD_VERSION = "2.104.5";
10
10
 
11
11
  // Copyright (c) Jupyter Development Team.
12
12
  // Distributed under the terms of the Modified BSD License.
@@ -9694,6 +9694,15 @@
9694
9694
  t[p[i]] = s[p[i]];
9695
9695
  }
9696
9696
  return t;
9697
+ }
9698
+
9699
+ /** @deprecated */
9700
+ function __spreadArrays() {
9701
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
9702
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
9703
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
9704
+ r[k] = a[j];
9705
+ return r;
9697
9706
  }
9698
9707
 
9699
9708
  // Copyright (c) Jupyter Development Team.
@@ -10163,7 +10172,6 @@
10163
10172
  }
10164
10173
  })(BoxEngine || (BoxEngine = {}));
10165
10174
 
10166
- // Copyright (c) Jupyter Development Team.
10167
10175
  /**
10168
10176
  * An object which holds data related to an object's title.
10169
10177
  *
@@ -10171,6 +10179,8 @@
10171
10179
  * A title object is intended to hold the data necessary to display a
10172
10180
  * header for a particular object. A common example is the `TabPanel`,
10173
10181
  * which uses the widget title to populate the tab for a child widget.
10182
+ *
10183
+ * It is the responsibility of the owner to call the title disposal.
10174
10184
  */
10175
10185
  var Title = /** @class */ (function () {
10176
10186
  /**
@@ -10187,6 +10197,7 @@
10187
10197
  this._className = '';
10188
10198
  this._closable = false;
10189
10199
  this._changed = new Signal(this);
10200
+ this._isDisposed = false;
10190
10201
  this.owner = options.owner;
10191
10202
  if (options.label !== undefined) {
10192
10203
  this._label = options.label;
@@ -10508,6 +10519,29 @@
10508
10519
  enumerable: true,
10509
10520
  configurable: true
10510
10521
  });
10522
+ Object.defineProperty(Title.prototype, "isDisposed", {
10523
+ /**
10524
+ * Test whether the title has been disposed.
10525
+ */
10526
+ get: function () {
10527
+ return this._isDisposed;
10528
+ },
10529
+ enumerable: true,
10530
+ configurable: true
10531
+ });
10532
+ /**
10533
+ * Dispose of the resources held by the title.
10534
+ *
10535
+ * #### Notes
10536
+ * It is the responsibility of the owner to call the title disposal.
10537
+ */
10538
+ Title.prototype.dispose = function () {
10539
+ if (this.isDisposed) {
10540
+ return;
10541
+ }
10542
+ this._isDisposed = true;
10543
+ Signal.clearData(this);
10544
+ };
10511
10545
  return Title;
10512
10546
  }());
10513
10547
 
@@ -10566,6 +10600,8 @@
10566
10600
  this._layout.dispose();
10567
10601
  this._layout = null;
10568
10602
  }
10603
+ // Dispose the title
10604
+ this.title.dispose();
10569
10605
  // Clear the extra data associated with the widget.
10570
10606
  Signal.clearData(this);
10571
10607
  MessageLoop.clearData(this);
@@ -12700,6 +12736,16 @@
12700
12736
  enumerable: true,
12701
12737
  configurable: true
12702
12738
  });
12739
+ /**
12740
+ * Get the absolute sizes of the widgets in the layout.
12741
+ *
12742
+ * @returns A new array of the absolute sizes of the widgets.
12743
+ *
12744
+ * This method **does not** measure the DOM nodes.
12745
+ */
12746
+ SplitLayout.prototype.absoluteSizes = function () {
12747
+ return this._sizers.map(function (sizer) { return sizer.size; });
12748
+ };
12703
12749
  /**
12704
12750
  * Get the relative sizes of the widgets in the layout.
12705
12751
  *
@@ -12718,13 +12764,16 @@
12718
12764
  * Set the relative sizes for the widgets in the layout.
12719
12765
  *
12720
12766
  * @param sizes - The relative sizes for the widgets in the panel.
12767
+ * @param update - Update the layout after setting relative sizes.
12768
+ * Default is True.
12721
12769
  *
12722
12770
  * #### Notes
12723
12771
  * Extra values are ignored, too few will yield an undefined layout.
12724
12772
  *
12725
12773
  * The actual geometry of the DOM nodes is updated asynchronously.
12726
12774
  */
12727
- SplitLayout.prototype.setRelativeSizes = function (sizes) {
12775
+ SplitLayout.prototype.setRelativeSizes = function (sizes, update) {
12776
+ if (update === void 0) { update = true; }
12728
12777
  // Copy the sizes and pad with zeros as needed.
12729
12778
  var n = this._sizers.length;
12730
12779
  var temp = sizes.slice(0, n);
@@ -12742,7 +12791,7 @@
12742
12791
  // Set the flag indicating the sizes are normalized.
12743
12792
  this._hasNormedSizes = true;
12744
12793
  // Trigger an update of the parent widget.
12745
- if (this.parent) {
12794
+ if (update && this.parent) {
12746
12795
  this.parent.update();
12747
12796
  }
12748
12797
  };
@@ -13513,6 +13562,7 @@
13513
13562
  function SplitPanel(options) {
13514
13563
  if (options === void 0) { options = {}; }
13515
13564
  var _this = _super.call(this, { layout: Private$e.createLayout(options) }) || this;
13565
+ _this._handleMoved = new Signal(_this);
13516
13566
  _this._pressData = null;
13517
13567
  _this.addClass('lm-SplitPanel');
13518
13568
  /* <DEPRECATED> */
@@ -13597,6 +13647,16 @@
13597
13647
  enumerable: true,
13598
13648
  configurable: true
13599
13649
  });
13650
+ Object.defineProperty(SplitPanel.prototype, "handleMoved", {
13651
+ /**
13652
+ * A signal emitted when a split handle has moved.
13653
+ */
13654
+ get: function () {
13655
+ return this._handleMoved;
13656
+ },
13657
+ enumerable: true,
13658
+ configurable: true
13659
+ });
13600
13660
  Object.defineProperty(SplitPanel.prototype, "handles", {
13601
13661
  /**
13602
13662
  * A read-only array of the split handles in the panel.
@@ -13625,14 +13685,17 @@
13625
13685
  * Set the relative sizes for the widgets in the panel.
13626
13686
  *
13627
13687
  * @param sizes - The relative sizes for the widgets in the panel.
13688
+ * @param update - Update the layout after setting relative sizes.
13689
+ * Default is True.
13628
13690
  *
13629
13691
  * #### Notes
13630
13692
  * Extra values are ignored, too few will yield an undefined layout.
13631
13693
  *
13632
13694
  * The actual geometry of the DOM nodes is updated asynchronously.
13633
13695
  */
13634
- SplitPanel.prototype.setRelativeSizes = function (sizes) {
13635
- this.layout.setRelativeSizes(sizes);
13696
+ SplitPanel.prototype.setRelativeSizes = function (sizes, update) {
13697
+ if (update === void 0) { update = true; }
13698
+ this.layout.setRelativeSizes(sizes, update);
13636
13699
  };
13637
13700
  /**
13638
13701
  * Handle the DOM events for the split panel.
@@ -13809,6 +13872,8 @@
13809
13872
  // Clear the override cursor.
13810
13873
  this._pressData.override.dispose();
13811
13874
  this._pressData = null;
13875
+ // Emit the handle moved signal.
13876
+ this._handleMoved.emit();
13812
13877
  // Remove the extra document listeners.
13813
13878
  document.removeEventListener('mouseup', this, true);
13814
13879
  document.removeEventListener('mousemove', this, true);
@@ -13909,6 +13974,7 @@
13909
13974
  function AccordionPanel(options) {
13910
13975
  if (options === void 0) { options = {}; }
13911
13976
  var _this = _super.call(this, __assign$1(__assign$1({}, options), { layout: Private$d.createLayout(options) })) || this;
13977
+ _this._widgetSizesCache = new WeakMap();
13912
13978
  _this.addClass('lm-AccordionPanel');
13913
13979
  return _this;
13914
13980
  }
@@ -13960,6 +14026,34 @@
13960
14026
  _super.prototype.addWidget.call(this, widget);
13961
14027
  widget.title.changed.connect(this._onTitleChanged, this);
13962
14028
  };
14029
+ /**
14030
+ * Collapse the widget at position `index`.
14031
+ *
14032
+ * #### Notes
14033
+ * If no widget is found for `index`, this will bail.
14034
+ *
14035
+ * @param index Widget index
14036
+ */
14037
+ AccordionPanel.prototype.collapse = function (index) {
14038
+ var widget = this.layout.widgets[index];
14039
+ if (widget && !widget.isHidden) {
14040
+ this._toggleExpansion(index);
14041
+ }
14042
+ };
14043
+ /**
14044
+ * Expand the widget at position `index`.
14045
+ *
14046
+ * #### Notes
14047
+ * If no widget is found for `index`, this will bail.
14048
+ *
14049
+ * @param index Widget index
14050
+ */
14051
+ AccordionPanel.prototype.expand = function (index) {
14052
+ var widget = this.layout.widgets[index];
14053
+ if (widget && widget.isHidden) {
14054
+ this._toggleExpansion(index);
14055
+ }
14056
+ };
13963
14057
  /**
13964
14058
  * Insert a widget at the specified index.
13965
14059
  *
@@ -14023,6 +14117,71 @@
14023
14117
  this.update();
14024
14118
  }
14025
14119
  };
14120
+ /**
14121
+ * Compute the size of widgets in this panel on the title click event.
14122
+ * On closing, the size of the widget is cached and we will try to expand
14123
+ * the last opened widget.
14124
+ * On opening, we will use the cached size if it is available to restore the
14125
+ * widget.
14126
+ * In both cases, if we can not compute the size of widgets, we will let
14127
+ * `SplitLayout` decide.
14128
+ *
14129
+ * @param index - The index of widget to be opened of closed
14130
+ *
14131
+ * @returns Relative size of widgets in this panel, if this size can
14132
+ * not be computed, return `undefined`
14133
+ */
14134
+ AccordionPanel.prototype._computeWidgetSize = function (index) {
14135
+ var layout = this.layout;
14136
+ var widget = layout.widgets[index];
14137
+ if (!widget) {
14138
+ return undefined;
14139
+ }
14140
+ var isHidden = widget.isHidden;
14141
+ var widgetSizes = layout.absoluteSizes();
14142
+ var delta = (isHidden ? -1 : 1) * this.spacing;
14143
+ var totalSize = widgetSizes.reduce(function (prev, curr) { return prev + curr; });
14144
+ var newSize = __spreadArrays(widgetSizes);
14145
+ if (!isHidden) {
14146
+ // Hide the widget
14147
+ var currentSize = widgetSizes[index];
14148
+ this._widgetSizesCache.set(widget, currentSize);
14149
+ newSize[index] = 0;
14150
+ var widgetToCollapse = newSize.map(function (sz) { return sz > 0; }).lastIndexOf(true);
14151
+ if (widgetToCollapse === -1) {
14152
+ // All widget are closed, let the `SplitLayout` compute widget sizes.
14153
+ return undefined;
14154
+ }
14155
+ newSize[widgetToCollapse] =
14156
+ widgetSizes[widgetToCollapse] + currentSize + delta;
14157
+ }
14158
+ else {
14159
+ // Show the widget
14160
+ var previousSize_1 = this._widgetSizesCache.get(widget);
14161
+ if (!previousSize_1) {
14162
+ // Previous size is unavailable, let the `SplitLayout` compute widget sizes.
14163
+ return undefined;
14164
+ }
14165
+ newSize[index] += previousSize_1;
14166
+ var widgetToCollapse = newSize
14167
+ .map(function (sz) { return sz - previousSize_1 > 0; })
14168
+ .lastIndexOf(true);
14169
+ if (widgetToCollapse === -1) {
14170
+ // Can not reduce the size of one widget, reduce all opened widgets
14171
+ // proportionally with its size.
14172
+ newSize.forEach(function (_, idx) {
14173
+ if (idx !== index) {
14174
+ newSize[idx] -=
14175
+ (widgetSizes[idx] / totalSize) * (previousSize_1 - delta);
14176
+ }
14177
+ });
14178
+ }
14179
+ else {
14180
+ newSize[widgetToCollapse] -= previousSize_1 - delta;
14181
+ }
14182
+ }
14183
+ return newSize.map(function (sz) { return sz / (totalSize + delta); });
14184
+ };
14026
14185
  /**
14027
14186
  * Handle the `'click'` event for the accordion panel
14028
14187
  */
@@ -14035,18 +14194,7 @@
14035
14194
  if (index >= 0) {
14036
14195
  event.preventDefault();
14037
14196
  event.stopPropagation();
14038
- var title = this.titles[index];
14039
- var widget = this.layout.widgets[index];
14040
- if (widget.isHidden) {
14041
- title.classList.add('lm-mod-expanded');
14042
- title.setAttribute('aria-expanded', 'true');
14043
- widget.show();
14044
- }
14045
- else {
14046
- title.classList.remove('lm-mod-expanded');
14047
- title.setAttribute('aria-expanded', 'false');
14048
- widget.hide();
14049
- }
14197
+ this._toggleExpansion(index);
14050
14198
  }
14051
14199
  }
14052
14200
  };
@@ -14098,6 +14246,24 @@
14098
14246
  }
14099
14247
  }
14100
14248
  };
14249
+ AccordionPanel.prototype._toggleExpansion = function (index) {
14250
+ var title = this.titles[index];
14251
+ var widget = this.layout.widgets[index];
14252
+ var newSize = this._computeWidgetSize(index);
14253
+ if (newSize) {
14254
+ this.setRelativeSizes(newSize, false);
14255
+ }
14256
+ if (widget.isHidden) {
14257
+ title.classList.add('lm-mod-expanded');
14258
+ title.setAttribute('aria-expanded', 'true');
14259
+ widget.show();
14260
+ }
14261
+ else {
14262
+ title.classList.remove('lm-mod-expanded');
14263
+ title.setAttribute('aria-expanded', 'false');
14264
+ widget.hide();
14265
+ }
14266
+ };
14101
14267
  return AccordionPanel;
14102
14268
  }(SplitPanel$1));
14103
14269
  /**
@@ -19577,7 +19743,10 @@
19577
19743
  // Create the root node for the new config.
19578
19744
  if (mainConfig) {
19579
19745
  this._root = Private$6.realizeAreaConfig(mainConfig, {
19580
- createTabBar: function () { return _this._createTabBar(); },
19746
+ // Ignoring optional `document` argument as we must reuse `this._document`
19747
+ createTabBar: function (document) {
19748
+ return _this._createTabBar();
19749
+ },
19581
19750
  createHandle: function () { return _this._createHandle(); }
19582
19751
  }, this._document);
19583
19752
  }
@@ -25693,7 +25862,7 @@
25693
25862
  var css_248z$9 = ".lm-TabPanel-tabBar,.p-TabPanel-tabBar{z-index:1}.lm-TabPanel-stackedPanel,.p-TabPanel-stackedPanel{z-index:0}";
25694
25863
  styleInject$1(css_248z$9);
25695
25864
 
25696
- /*! *****************************************************************************
25865
+ /******************************************************************************
25697
25866
  Copyright (c) Microsoft Corporation.
25698
25867
 
25699
25868
  Permission to use, copy, modify, and/or distribute this software for any