@deephaven/golden-layout 0.19.2-beta.4 → 0.20.0

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.
Files changed (144) hide show
  1. package/dist/LayoutManager.d.ts +313 -0
  2. package/dist/LayoutManager.d.ts.map +1 -0
  3. package/dist/LayoutManager.js +468 -450
  4. package/dist/LayoutManager.js.map +1 -1
  5. package/dist/base.d.ts +16 -0
  6. package/dist/base.d.ts.map +1 -0
  7. package/dist/base.js +6 -6
  8. package/dist/base.js.map +1 -1
  9. package/dist/config/Config.d.ts +146 -0
  10. package/dist/config/Config.d.ts.map +1 -0
  11. package/dist/config/{defaultConfig.js → Config.js} +6 -6
  12. package/dist/config/Config.js.map +1 -0
  13. package/dist/config/ItemConfig.d.ts +66 -0
  14. package/dist/config/ItemConfig.d.ts.map +1 -0
  15. package/dist/config/ItemConfig.js +14 -0
  16. package/dist/config/ItemConfig.js.map +1 -0
  17. package/dist/config/index.d.ts +3 -0
  18. package/dist/config/index.d.ts.map +1 -0
  19. package/dist/config/index.js +2 -6
  20. package/dist/config/index.js.map +1 -1
  21. package/dist/container/ItemContainer.d.ts +91 -0
  22. package/dist/container/ItemContainer.d.ts.map +1 -0
  23. package/dist/container/ItemContainer.js +110 -85
  24. package/dist/container/ItemContainer.js.map +1 -1
  25. package/dist/container/index.d.ts +3 -0
  26. package/dist/container/index.d.ts.map +1 -0
  27. package/dist/container/index.js +2 -4
  28. package/dist/container/index.js.map +1 -1
  29. package/dist/controls/BrowserPopout.d.ts +83 -0
  30. package/dist/controls/BrowserPopout.d.ts.map +1 -0
  31. package/dist/controls/BrowserPopout.js +135 -101
  32. package/dist/controls/BrowserPopout.js.map +1 -1
  33. package/dist/controls/DragProxy.d.ts +67 -0
  34. package/dist/controls/DragProxy.d.ts.map +1 -0
  35. package/dist/controls/DragProxy.js +135 -110
  36. package/dist/controls/DragProxy.js.map +1 -1
  37. package/dist/controls/DragSource.d.ts +30 -0
  38. package/dist/controls/DragSource.d.ts.map +1 -0
  39. package/dist/controls/DragSource.js +37 -29
  40. package/dist/controls/DragSource.js.map +1 -1
  41. package/dist/controls/DragSourceFromEvent.d.ts +30 -0
  42. package/dist/controls/DragSourceFromEvent.d.ts.map +1 -0
  43. package/dist/controls/DragSourceFromEvent.js +49 -36
  44. package/dist/controls/DragSourceFromEvent.js.map +1 -1
  45. package/dist/controls/DropTargetIndicator.d.ts +14 -0
  46. package/dist/controls/DropTargetIndicator.d.ts.map +1 -0
  47. package/dist/controls/DropTargetIndicator.js +18 -14
  48. package/dist/controls/DropTargetIndicator.js.map +1 -1
  49. package/dist/controls/Header.d.ts +145 -0
  50. package/dist/controls/Header.d.ts.map +1 -0
  51. package/dist/controls/Header.js +414 -271
  52. package/dist/controls/Header.js.map +1 -1
  53. package/dist/controls/HeaderButton.d.ts +9 -0
  54. package/dist/controls/HeaderButton.d.ts.map +1 -0
  55. package/dist/controls/HeaderButton.js +19 -13
  56. package/dist/controls/HeaderButton.js.map +1 -1
  57. package/dist/controls/Splitter.d.ts +12 -0
  58. package/dist/controls/Splitter.d.ts.map +1 -0
  59. package/dist/controls/Splitter.js +36 -20
  60. package/dist/controls/Splitter.js.map +1 -1
  61. package/dist/controls/Tab.d.ts +91 -0
  62. package/dist/controls/Tab.d.ts.map +1 -0
  63. package/dist/controls/Tab.js +131 -119
  64. package/dist/controls/Tab.js.map +1 -1
  65. package/dist/controls/TransitionIndicator.d.ts +25 -0
  66. package/dist/controls/TransitionIndicator.d.ts.map +1 -0
  67. package/dist/controls/TransitionIndicator.js +53 -39
  68. package/dist/controls/TransitionIndicator.js.map +1 -1
  69. package/dist/controls/index.d.ts +11 -0
  70. package/dist/controls/index.d.ts.map +1 -0
  71. package/dist/controls/index.js +10 -22
  72. package/dist/controls/index.js.map +1 -1
  73. package/dist/errors/ConfigurationError.d.ts +6 -0
  74. package/dist/errors/ConfigurationError.d.ts.map +1 -0
  75. package/dist/errors/ConfigurationError.js +15 -8
  76. package/dist/errors/ConfigurationError.js.map +1 -1
  77. package/dist/errors/index.d.ts +2 -0
  78. package/dist/errors/index.d.ts.map +1 -0
  79. package/dist/errors/index.js +1 -4
  80. package/dist/errors/index.js.map +1 -1
  81. package/dist/index.d.ts +9 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +7 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/items/AbstractContentItem.d.ts +233 -0
  86. package/dist/items/AbstractContentItem.d.ts.map +1 -0
  87. package/dist/items/AbstractContentItem.js +284 -242
  88. package/dist/items/AbstractContentItem.js.map +1 -1
  89. package/dist/items/Component.d.ts +30 -0
  90. package/dist/items/Component.d.ts.map +1 -0
  91. package/dist/items/Component.js +61 -42
  92. package/dist/items/Component.js.map +1 -1
  93. package/dist/items/Root.d.ts +18 -0
  94. package/dist/items/Root.d.ts.map +1 -0
  95. package/dist/items/Root.js +68 -38
  96. package/dist/items/Root.js.map +1 -1
  97. package/dist/items/RowOrColumn.d.ts +157 -0
  98. package/dist/items/RowOrColumn.d.ts.map +1 -0
  99. package/dist/items/RowOrColumn.js +219 -187
  100. package/dist/items/RowOrColumn.js.map +1 -1
  101. package/dist/items/Stack.d.ts +108 -0
  102. package/dist/items/Stack.d.ts.map +1 -0
  103. package/dist/items/Stack.js +218 -151
  104. package/dist/items/Stack.js.map +1 -1
  105. package/dist/items/index.d.ts +8 -0
  106. package/dist/items/index.d.ts.map +1 -0
  107. package/dist/items/index.js +7 -12
  108. package/dist/items/index.js.map +1 -1
  109. package/dist/utils/BubblingEvent.d.ts +8 -0
  110. package/dist/utils/BubblingEvent.d.ts.map +1 -0
  111. package/dist/utils/BubblingEvent.js +18 -9
  112. package/dist/utils/BubblingEvent.js.map +1 -1
  113. package/dist/utils/ConfigMinifier.d.ts +21 -0
  114. package/dist/utils/ConfigMinifier.d.ts.map +1 -0
  115. package/dist/utils/ConfigMinifier.js +121 -121
  116. package/dist/utils/ConfigMinifier.js.map +1 -1
  117. package/dist/utils/DragListener.d.ts +34 -0
  118. package/dist/utils/DragListener.d.ts.map +1 -0
  119. package/dist/utils/DragListener.js +103 -70
  120. package/dist/utils/DragListener.js.map +1 -1
  121. package/dist/utils/EventEmitter.d.ts +59 -0
  122. package/dist/utils/EventEmitter.d.ts.map +1 -0
  123. package/dist/utils/EventEmitter.js +64 -70
  124. package/dist/utils/EventEmitter.js.map +1 -1
  125. package/dist/utils/EventHub.d.ts +55 -0
  126. package/dist/utils/EventHub.d.ts.map +1 -0
  127. package/dist/utils/EventHub.js +83 -105
  128. package/dist/utils/EventHub.js.map +1 -1
  129. package/dist/utils/ReactComponentHandler.d.ts +54 -0
  130. package/dist/utils/ReactComponentHandler.d.ts.map +1 -0
  131. package/dist/utils/ReactComponentHandler.js +58 -56
  132. package/dist/utils/ReactComponentHandler.js.map +1 -1
  133. package/dist/utils/index.d.ts +8 -0
  134. package/dist/utils/index.d.ts.map +1 -0
  135. package/dist/utils/index.js +7 -21
  136. package/dist/utils/index.js.map +1 -1
  137. package/dist/utils/utils.d.ts +25 -0
  138. package/dist/utils/utils.d.ts.map +1 -0
  139. package/dist/utils/utils.js +21 -145
  140. package/dist/utils/utils.js.map +1 -1
  141. package/package.json +9 -5
  142. package/dist/config/ItemDefaultConfig.js +0 -8
  143. package/dist/config/ItemDefaultConfig.js.map +0 -1
  144. package/dist/config/defaultConfig.js.map +0 -1
@@ -1,109 +1,143 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  import $ from 'jquery';
2
- import utils from '../utils/index.js';
3
- import HeaderButton from './HeaderButton.js';
4
- import Tab from './Tab.js';
4
+ import { EventEmitter } from "../utils/index.js";
5
+ import HeaderButton from "./HeaderButton.js";
6
+ import Tab from "./Tab.js";
5
7
  /**
6
8
  * This class represents a header above a Stack ContentItem.
7
9
  *
8
- * @param {lm.LayoutManager} layoutManager
9
- * @param {lm.item.AbstractContentItem} parent
10
+ * @param layoutManager
11
+ * @param parent
10
12
  */
11
13
 
12
- var Header = function Header(layoutManager, parent) {
13
- utils.EventEmitter.call(this);
14
- this.layoutManager = layoutManager;
15
- this.element = $(Header._template);
14
+ export default class Header extends EventEmitter {
15
+ // use for scroll repeat
16
+ // mouse hold timeout to act as hold instead of click
17
+ // mouse hold acceleration
18
+ constructor(layoutManager, parent) {
19
+ var _this$layoutManager$c, _this$layoutManager$c2;
16
20
 
17
- if (this.layoutManager.config.settings.selectionEnabled === true) {
18
- this.element.addClass('lm_selectable');
19
- this.element.on('click', utils.fnBind(this._onHeaderClick, this));
20
- }
21
+ super();
22
+
23
+ _defineProperty(this, "layoutManager", void 0);
24
+
25
+ _defineProperty(this, "element", $(Header._template));
26
+
27
+ _defineProperty(this, "tabsContainer", void 0);
28
+
29
+ _defineProperty(this, "tabDropdownContainer", void 0);
30
+
31
+ _defineProperty(this, "tabDropdownSearch", void 0);
32
+
33
+ _defineProperty(this, "tabDropdownList", null);
34
+
35
+ _defineProperty(this, "controlsContainer", void 0);
36
+
37
+ _defineProperty(this, "parent", void 0);
38
+
39
+ _defineProperty(this, "tabs", []);
40
+
41
+ _defineProperty(this, "activeContentItem", null);
42
+
43
+ _defineProperty(this, "closeButton", null);
44
+
45
+ _defineProperty(this, "tabDropdownButton", null);
46
+
47
+ _defineProperty(this, "tabNextButton", $(Header._nextButtonTemplate));
48
+
49
+ _defineProperty(this, "tabPreviousButton", $(Header._previousButtonTemplate));
50
+
51
+ _defineProperty(this, "holdTimer", null);
52
+
53
+ _defineProperty(this, "rAF", null);
54
+
55
+ _defineProperty(this, "CLICK_TIMEOUT", 500);
56
+
57
+ _defineProperty(this, "START_SPEED", 0.01);
58
+
59
+ _defineProperty(this, "ACCELERATION", 0.0005);
60
+
61
+ _defineProperty(this, "SCROLL_LEFT", 'left');
62
+
63
+ _defineProperty(this, "SCROLL_RIGHT", 'right');
64
+
65
+ _defineProperty(this, "isDraggingTab", false);
66
+
67
+ _defineProperty(this, "isOverflowing", false);
68
+
69
+ _defineProperty(this, "isDropdownShown", false);
21
70
 
22
- this.tabsContainer = this.element.find('.lm_tabs');
23
- this.tabDropdownContainer = this.element.find('.lm_tabdropdown_list');
24
- this.tabDropdownContainer.hide();
25
- this.tabDropdownSearch = this.element.find('.lm_tabdropdown_search input');
26
- this.tabDropdownList = null;
27
- this._handleFilterInput = this._handleFilterInput.bind(this);
28
- this._handleFilterKeydown = this._handleFilterKeydown.bind(this);
29
- this.tabDropdownSearch.on('input', this._handleFilterInput);
30
- this.tabDropdownSearch.on('keydown', this._handleFilterKeydown);
31
- this.controlsContainer = this.element.find('.lm_controls');
32
- this.parent = parent;
33
- this.parent.on('resize', this._updateTabSizes, this);
34
- this.tabs = [];
35
- this.activeContentItem = null;
36
- this.closeButton = null;
37
- this.tabDropdownButton = null;
38
- this.tabNextButton = $(Header._nextButtonTemplate);
39
- this.tabPreviousButton = $(Header._previousButtonTemplate);
40
- this._handleItemPickedUp = this._handleItemPickedUp.bind(this);
41
- this._handleItemDropped = this._handleItemDropped.bind(this);
42
- this._handleNextMouseEnter = this._handleNextMouseEnter.bind(this);
43
- this._handleNextMouseLeave = this._handleNextMouseLeave.bind(this);
44
- this._handlePreviousMouseEnter = this._handlePreviousMouseEnter.bind(this);
45
- this._handlePreviousMouseLeave = this._handlePreviousMouseLeave.bind(this);
46
- this._handleScrollRepeat = this._handleScrollRepeat.bind(this);
47
- this._handleNextButtonMouseDown = this._handleNextButtonMouseDown.bind(this);
48
- this._handlePreviousButtonMouseDown = this._handlePreviousButtonMouseDown.bind(this);
49
- this._handleScrollButtonMouseDown = this._handleScrollButtonMouseDown.bind(this);
50
- this._handleScrollButtonMouseUp = this._handleScrollButtonMouseUp.bind(this);
51
- this._handleScrollEvent = this._handleScrollEvent.bind(this);
52
- this.tabNextButton.on('mousedown', this._handleNextButtonMouseDown);
53
- this.tabPreviousButton.on('mousedown', this._handlePreviousButtonMouseDown);
54
- this.tabsContainer.on('scroll', this._handleScrollEvent); // use for scroll repeat
55
-
56
- this.holdTimer = null;
57
- this.rAF = null; // mouse hold timeout to act as hold instead of click
58
-
59
- this.CLICK_TIMEOUT = 500; // mouse hold acceleration
60
-
61
- this.START_SPEED = 0.01;
62
- this.ACCELERATION = 0.0005;
63
- this.SCROLL_LEFT = 'left';
64
- this.SCROLL_RIGHT = 'right';
65
- this.layoutManager.on('itemPickedUp', this._handleItemPickedUp);
66
- this.layoutManager.on('itemDropped', this._handleItemDropped);
67
- this.isDraggingTab = false;
68
- this.isOverflowing = false;
69
- this.isDropdownShown = false;
70
- this.dropdownKeyIndex = 0; // append previous button template
71
-
72
- this.tabsContainer.before(this.tabPreviousButton); // change reference to just the li, not the wrapping ul
73
-
74
- this.tabPreviousButton = this.tabPreviousButton.find('>:first-child');
75
- this.tabPreviousButton.hide();
76
- this._showAdditionalTabsDropdown = this._showAdditionalTabsDropdown.bind(this);
77
- this._hideAdditionalTabsDropdown = this._hideAdditionalTabsDropdown.bind(this);
78
- this._lastVisibleTabIndex = -1;
79
- this._tabControlOffset = this.layoutManager.config.settings.tabControlOffset;
80
-
81
- this._createControls();
82
- };
83
-
84
- Header._template = ['<div class="lm_header">', '<ul class="lm_tabs"></ul>', '<ul class="lm_controls"></ul>', '<ul class="lm_tabdropdown_list">', '<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>', '</ul>', '</div>'].join('');
85
- Header._previousButtonTemplate = ['<ul class="lm_controls">', '<li class="lm_tabpreviousbutton"></li>', '</ul>'].join('');
86
- Header._nextButtonTemplate = ['<li class="lm_tabnextbutton"></li>'].join('');
87
- utils.copy(Header.prototype, {
71
+ _defineProperty(this, "dropdownKeyIndex", 0);
72
+
73
+ _defineProperty(this, "_lastVisibleTabIndex", -1);
74
+
75
+ _defineProperty(this, "_tabControlOffset", void 0);
76
+
77
+ this.layoutManager = layoutManager;
78
+
79
+ if ((_this$layoutManager$c = this.layoutManager.config.settings) !== null && _this$layoutManager$c !== void 0 && _this$layoutManager$c.selectionEnabled) {
80
+ this.element.addClass('lm_selectable');
81
+ this.element.on('click', this._onHeaderClick.bind(this));
82
+ }
83
+
84
+ this.tabsContainer = this.element.find('.lm_tabs');
85
+ this.tabDropdownContainer = this.element.find('.lm_tabdropdown_list');
86
+ this.tabDropdownContainer.hide();
87
+ this.tabDropdownSearch = this.element.find('.lm_tabdropdown_search input');
88
+ this._handleFilterInput = this._handleFilterInput.bind(this);
89
+ this._handleFilterKeydown = this._handleFilterKeydown.bind(this);
90
+ this.tabDropdownSearch.on('input', this._handleFilterInput);
91
+ this.tabDropdownSearch.on('keydown', this._handleFilterKeydown);
92
+ this.controlsContainer = this.element.find('.lm_controls');
93
+ this.parent = parent;
94
+ this.parent.on('resize', this._updateTabSizes, this);
95
+ this._handleItemPickedUp = this._handleItemPickedUp.bind(this);
96
+ this._handleItemDropped = this._handleItemDropped.bind(this);
97
+ this._handleNextMouseEnter = this._handleNextMouseEnter.bind(this);
98
+ this._handleNextMouseLeave = this._handleNextMouseLeave.bind(this);
99
+ this._handlePreviousMouseEnter = this._handlePreviousMouseEnter.bind(this);
100
+ this._handlePreviousMouseLeave = this._handlePreviousMouseLeave.bind(this);
101
+ this._handleScrollRepeat = this._handleScrollRepeat.bind(this);
102
+ this._handleNextButtonMouseDown = this._handleNextButtonMouseDown.bind(this);
103
+ this._handlePreviousButtonMouseDown = this._handlePreviousButtonMouseDown.bind(this);
104
+ this._handleScrollButtonMouseDown = this._handleScrollButtonMouseDown.bind(this);
105
+ this._handleScrollButtonMouseUp = this._handleScrollButtonMouseUp.bind(this);
106
+ this._handleScrollEvent = this._handleScrollEvent.bind(this);
107
+ this.tabNextButton.on('mousedown', this._handleNextButtonMouseDown);
108
+ this.tabPreviousButton.on('mousedown', this._handlePreviousButtonMouseDown);
109
+ this.tabsContainer.on('scroll', this._handleScrollEvent);
110
+ this.layoutManager.on('itemPickedUp', this._handleItemPickedUp);
111
+ this.layoutManager.on('itemDropped', this._handleItemDropped); // append previous button template
112
+
113
+ this.tabsContainer.before(this.tabPreviousButton); // change reference to just the li, not the wrapping ul
114
+
115
+ this.tabPreviousButton = this.tabPreviousButton.find('>:first-child');
116
+ this.tabPreviousButton.hide();
117
+ this._showAdditionalTabsDropdown = this._showAdditionalTabsDropdown.bind(this);
118
+ this._hideAdditionalTabsDropdown = this._hideAdditionalTabsDropdown.bind(this);
119
+ this._tabControlOffset = (_this$layoutManager$c2 = this.layoutManager.config.settings) === null || _this$layoutManager$c2 === void 0 ? void 0 : _this$layoutManager$c2.tabControlOffset;
120
+
121
+ this._createControls();
122
+ }
88
123
  /**
89
124
  * Creates a new tab and associates it with a contentItem
90
125
  *
91
- * @param {lm.item.AbstractContentItem} contentItem
92
- * @param {Integer} index The position of the tab
93
- *
94
- * @returns {void}
126
+ * @param contentItem
127
+ * @param index The position of the tab
95
128
  */
96
- createTab: function createTab(contentItem, index) {
97
- var tab, i; //If there's already a tab relating to the
98
- //content item, don't do anything
99
129
 
100
- for (i = 0; i < this.tabs.length; i++) {
130
+
131
+ createTab(contentItem, index) {
132
+ //If there's already a tab relating to the
133
+ //content item, don't do anything
134
+ for (var i = 0; i < this.tabs.length; i++) {
101
135
  if (this.tabs[i].contentItem === contentItem) {
102
136
  return;
103
137
  }
104
138
  }
105
139
 
106
- tab = new Tab(this, contentItem);
140
+ var tab = new Tab(this, contentItem);
107
141
 
108
142
  if (this.tabs.length === 0) {
109
143
  this.tabs.push(tab);
@@ -124,16 +158,15 @@ utils.copy(Header.prototype, {
124
158
  this.tabs.splice(index, 0, tab);
125
159
 
126
160
  this._updateTabSizes();
127
- },
128
-
161
+ }
129
162
  /**
130
163
  * Finds a tab based on the contentItem its associated with and removes it.
131
164
  *
132
- * @param {lm.item.AbstractContentItem} contentItem
133
- *
134
- * @returns {void}
165
+ * @param contentItem
135
166
  */
136
- removeTab: function removeTab(contentItem) {
167
+
168
+
169
+ removeTab(contentItem) {
137
170
  for (var i = 0; i < this.tabs.length; i++) {
138
171
  if (this.tabs[i].contentItem === contentItem) {
139
172
  this.tabs[i]._$destroy();
@@ -144,14 +177,17 @@ utils.copy(Header.prototype, {
144
177
  }
145
178
 
146
179
  throw new Error('contentItem is not controlled by this header');
147
- },
148
-
180
+ }
149
181
  /**
150
182
  * The programmatical equivalent of clicking a Tab.
151
183
  *
152
- * @param {lm.item.AbstractContentItem} contentItem
184
+ * @param contentItem
153
185
  */
154
- setActiveContentItem: function setActiveContentItem(contentItem) {
186
+
187
+
188
+ setActiveContentItem(contentItem) {
189
+ var _this$tabs$element$ge, _this$parent$config$a;
190
+
155
191
  var isActive;
156
192
 
157
193
  for (var i = 0; i < this.tabs.length; i++) {
@@ -165,7 +201,7 @@ utils.copy(Header.prototype, {
165
201
  } // makes sure dropped tabs are scrollintoview, removed any re-ordering
166
202
 
167
203
 
168
- this.tabs[this.parent.config.activeItemIndex].element.get(0).scrollIntoView({
204
+ (_this$tabs$element$ge = this.tabs[(_this$parent$config$a = this.parent.config.activeItemIndex) !== null && _this$parent$config$a !== void 0 ? _this$parent$config$a : 0].element.get(0)) === null || _this$tabs$element$ge === void 0 ? void 0 : _this$tabs$element$ge.scrollIntoView({
169
205
  inline: 'nearest'
170
206
  });
171
207
 
@@ -174,105 +210,141 @@ utils.copy(Header.prototype, {
174
210
  this._updateTabSizes();
175
211
 
176
212
  this.parent.emitBubblingEvent('stateChanged');
177
- },
178
-
213
+ }
179
214
  /**
180
215
  * Programmatically operate with header position.
181
216
  *
182
- * @param {string} position one of ('top','left','right','bottom') to set or empty to get it.
217
+ * @param position one of ('top','left','right','bottom') to set or empty to get it.
183
218
  *
184
- * @returns {string} previous header position
219
+ * @returns previous header position
185
220
  */
186
- position: function position(_position) {
221
+
222
+
223
+ position(position) {
187
224
  var previous = this.parent._header.show;
188
225
  if (previous && !this.parent._side) previous = 'top';
189
226
 
190
- if (_position !== undefined && this.parent._header.show !== _position) {
191
- this.parent._header.show = _position;
227
+ if (position !== undefined && this.parent._header.show !== position) {
228
+ this.parent._header.show = position;
192
229
 
193
230
  this.parent._setupHeaderPosition();
194
231
  }
195
232
 
196
233
  return previous;
197
- },
198
- // Manually attaching so wheel can be passive instead of jquery .on
234
+ } // Manually attaching so wheel can be passive instead of jquery .on
199
235
  // _attachWheelListener is called by parent init
200
- _attachWheelListener: function _attachWheelListener() {
201
- this.tabsContainer.get(0).addEventListener('wheel', this._handleWheelEvent, {
202
- passive: true
203
- });
204
- },
205
- // detach called by this.destroy
206
- _detachWheelListener: function _detachWheelListener() {
207
- this.tabsContainer.get(0).removeEventListener('wheel', this._handleWheelEvent, {
236
+
237
+
238
+ _attachWheelListener() {
239
+ var _this$tabsContainer$g;
240
+
241
+ (_this$tabsContainer$g = this.tabsContainer.get(0)) === null || _this$tabsContainer$g === void 0 ? void 0 : _this$tabsContainer$g.addEventListener('wheel', this._handleWheelEvent, {
208
242
  passive: true
209
243
  });
210
- },
211
- _handleWheelEvent: function _handleWheelEvent(event) {
212
- var target = event.currentTarget; // we only care about the larger of the two deltas
244
+ } // detach called by this.destroy
245
+
246
+
247
+ _detachWheelListener() {
248
+ var _this$tabsContainer$g2;
249
+
250
+ (_this$tabsContainer$g2 = this.tabsContainer.get(0)) === null || _this$tabsContainer$g2 === void 0 ? void 0 : _this$tabsContainer$g2.removeEventListener('wheel', this._handleWheelEvent);
251
+ }
252
+
253
+ _handleWheelEvent(event) {
254
+ var target = event.currentTarget;
255
+
256
+ if (!(target instanceof HTMLElement)) {
257
+ return;
258
+ } // we only care about the larger of the two deltas
259
+
213
260
 
214
261
  var delta = Math.abs(event.deltaY) > Math.abs(event.deltaX) ? event.deltaY : event.deltaX; // jshint
215
262
 
216
263
  /* globals WheelEvent */
217
264
 
218
265
  if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
266
+ var _this$tabsContainer$i;
267
+
219
268
  // Users can set OS to be in deltaMode page
220
269
  // scrolly by page units as pixels
221
- delta *= this.tabsContainer.innerWidhth();
270
+ delta *= (_this$tabsContainer$i = this.tabsContainer.innerWidth()) !== null && _this$tabsContainer$i !== void 0 ? _this$tabsContainer$i : 1;
222
271
  } else if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) {
223
272
  // chrome goes 100px per 3 lines, and firefox would go 102 per 3 (17 lineheight * 3 lines * 2)
224
273
  delta *= 100 / 3;
225
274
  }
226
275
 
227
276
  target.scrollLeft += Math.round(delta);
228
- },
229
- // on scroll we need to check if side error might need to be disabled
230
- _handleScrollEvent: function _handleScrollEvent() {
277
+ } // on scroll we need to check if side error might need to be disabled
278
+
279
+
280
+ _handleScrollEvent() {
231
281
  this._checkScrollArrows();
232
- },
233
- // when and item is picked up, attach mouse enter listeners to next/previous buttons
234
- _handleItemPickedUp: function _handleItemPickedUp() {
282
+ } // when and item is picked up, attach mouse enter listeners to next/previous buttons
283
+
284
+
285
+ _handleItemPickedUp() {
235
286
  this.isDraggingTab = true;
236
287
  this.controlsContainer.on('mouseenter', this._handleNextMouseEnter);
237
288
  this.tabPreviousButton.on('mouseenter', this._handlePreviousMouseEnter);
238
- },
239
- // when an item is dropped remove listeners and cancel animation
240
- _handleItemDropped: function _handleItemDropped() {
289
+ } // when an item is dropped remove listeners and cancel animation
290
+
291
+
292
+ _handleItemDropped() {
293
+ var _this$rAF;
294
+
241
295
  this.isDraggingTab = false;
242
- this.rAF = window.cancelAnimationFrame(this.rAF);
296
+ window.cancelAnimationFrame((_this$rAF = this.rAF) !== null && _this$rAF !== void 0 ? _this$rAF : -1);
297
+ this.rAF = null;
243
298
  this.controlsContainer.off('mouseenter', this._handleNextMouseEnter);
244
299
  this.controlsContainer.off('mouseleave', this._handleNextMouseLeave);
245
300
  this.tabPreviousButton.off('mouseenter', this._handlePreviousMouseEnter);
246
301
  this.tabPreviousButton.off('mouseleave', this._handlePreviousMouseLeave);
247
- },
248
- // on next/previous enter start scroll repeat animation loop
302
+ } // on next/previous enter start scroll repeat animation loop
249
303
  // and attach a listener looking for mouseleave
250
304
  // cancel animation on mouse leave, and remove leave listener
251
- _handleNextMouseEnter: function _handleNextMouseEnter() {
305
+
306
+
307
+ _handleNextMouseEnter() {
308
+ var _this$tabsContainer$s;
309
+
252
310
  this.controlsContainer.on('mouseleave', this._handleNextMouseLeave);
253
311
 
254
- this._handleScrollRepeat(this.SCROLL_RIGHT, this.tabsContainer.scrollLeft());
255
- },
256
- _handlePreviousMouseEnter: function _handlePreviousMouseEnter() {
312
+ this._handleScrollRepeat(this.SCROLL_RIGHT, (_this$tabsContainer$s = this.tabsContainer.scrollLeft()) !== null && _this$tabsContainer$s !== void 0 ? _this$tabsContainer$s : 0);
313
+ }
314
+
315
+ _handlePreviousMouseEnter() {
316
+ var _this$tabsContainer$s2;
317
+
257
318
  this.tabPreviousButton.on('mouseleave', this._handlePreviousMouseLeave);
258
319
 
259
- this._handleScrollRepeat(this.SCROLL_LEFT, this.tabsContainer.scrollLeft());
260
- },
261
- _handleNextMouseLeave: function _handleNextMouseLeave() {
262
- this.rAF = window.cancelAnimationFrame(this.rAF);
320
+ this._handleScrollRepeat(this.SCROLL_LEFT, (_this$tabsContainer$s2 = this.tabsContainer.scrollLeft()) !== null && _this$tabsContainer$s2 !== void 0 ? _this$tabsContainer$s2 : 0);
321
+ }
322
+
323
+ _handleNextMouseLeave() {
324
+ var _this$rAF2;
325
+
326
+ window.cancelAnimationFrame((_this$rAF2 = this.rAF) !== null && _this$rAF2 !== void 0 ? _this$rAF2 : -1);
327
+ this.rAF = null;
263
328
  this.controlsContainer.off('mouseleave', this._handleNextMouseLeave);
264
- },
265
- _handlePreviousMouseLeave: function _handlePreviousMouseLeave() {
266
- this.rAF = window.cancelAnimationFrame(this.rAF);
329
+ }
330
+
331
+ _handlePreviousMouseLeave() {
332
+ var _this$rAF3;
333
+
334
+ window.cancelAnimationFrame((_this$rAF3 = this.rAF) !== null && _this$rAF3 !== void 0 ? _this$rAF3 : -1);
335
+ this.rAF = null;
267
336
  this.tabPreviousButton.off('mouseleave', this._handlePreviousMouseLeave);
268
- },
269
- // scroll one tab to the right on mouse down
337
+ } // scroll one tab to the right on mouse down
270
338
  // start scrollRepeat if mouse is held down
271
- _handleNextButtonMouseDown: function _handleNextButtonMouseDown() {
339
+
340
+
341
+ _handleNextButtonMouseDown() {
272
342
  var rightOffscreenChild;
273
343
 
274
344
  for (var i = 0; i < this.tabs.length; i += 1) {
275
- if (this.tabs[i].element.get(0).offsetLeft > this.tabsContainer.get(0).offsetWidth + this.tabsContainer.scrollLeft()) {
345
+ var _this$tabs$i$element$, _this$tabs$i$element$2, _this$tabsContainer$g3, _this$tabsContainer$g4, _this$tabsContainer$s3;
346
+
347
+ if (((_this$tabs$i$element$ = (_this$tabs$i$element$2 = this.tabs[i].element.get(0)) === null || _this$tabs$i$element$2 === void 0 ? void 0 : _this$tabs$i$element$2.offsetLeft) !== null && _this$tabs$i$element$ !== void 0 ? _this$tabs$i$element$ : 0) > ((_this$tabsContainer$g3 = (_this$tabsContainer$g4 = this.tabsContainer.get(0)) === null || _this$tabsContainer$g4 === void 0 ? void 0 : _this$tabsContainer$g4.offsetWidth) !== null && _this$tabsContainer$g3 !== void 0 ? _this$tabsContainer$g3 : 0) + ((_this$tabsContainer$s3 = this.tabsContainer.scrollLeft()) !== null && _this$tabsContainer$s3 !== void 0 ? _this$tabsContainer$s3 : 0)) {
276
348
  rightOffscreenChild = this.tabs[i].element.get(0);
277
349
  break;
278
350
  }
@@ -286,16 +358,25 @@ utils.copy(Header.prototype, {
286
358
 
287
359
  this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);
288
360
  } else {
289
- this.tabsContainer.get(0).scrollLeft = this.tabsContainer.get(0).scrollWidth;
361
+ var tabsContainer = this.tabsContainer.get(0);
362
+
363
+ if (tabsContainer) {
364
+ var _this$tabsContainer$g5, _this$tabsContainer$g6;
365
+
366
+ tabsContainer.scrollLeft = (_this$tabsContainer$g5 = (_this$tabsContainer$g6 = this.tabsContainer.get(0)) === null || _this$tabsContainer$g6 === void 0 ? void 0 : _this$tabsContainer$g6.scrollWidth) !== null && _this$tabsContainer$g5 !== void 0 ? _this$tabsContainer$g5 : 0;
367
+ }
290
368
  }
291
- },
292
- // scroll left by one tab
369
+ } // scroll left by one tab
293
370
  // start scrollRepeat if mouse is held down
294
- _handlePreviousButtonMouseDown: function _handlePreviousButtonMouseDown() {
371
+
372
+
373
+ _handlePreviousButtonMouseDown() {
295
374
  var leftOffscreenChild;
296
375
 
297
376
  for (var i = this.tabs.length - 1; i >= 0; i -= 1) {
298
- if (this.tabs[i].element.get(0).offsetLeft < this.tabsContainer.scrollLeft()) {
377
+ var _this$tabs$i$element$3, _this$tabs$i$element$4, _this$tabsContainer$s4;
378
+
379
+ if (((_this$tabs$i$element$3 = (_this$tabs$i$element$4 = this.tabs[i].element.get(0)) === null || _this$tabs$i$element$4 === void 0 ? void 0 : _this$tabs$i$element$4.offsetLeft) !== null && _this$tabs$i$element$3 !== void 0 ? _this$tabs$i$element$3 : 0) < ((_this$tabsContainer$s4 = this.tabsContainer.scrollLeft()) !== null && _this$tabsContainer$s4 !== void 0 ? _this$tabsContainer$s4 : 0)) {
299
380
  leftOffscreenChild = this.tabs[i].element.get(0);
300
381
  break;
301
382
  }
@@ -309,43 +390,68 @@ utils.copy(Header.prototype, {
309
390
 
310
391
  this._handleScrollButtonMouseDown(this.SCROLL_LEFT);
311
392
  } else {
312
- this.tabsContainer.get(0).scrollLeft = 0;
393
+ var tabsContainer = this.tabsContainer.get(0);
394
+
395
+ if (tabsContainer) {
396
+ tabsContainer.scrollLeft = 0;
397
+ }
313
398
  }
314
- },
315
- // when hold timer is reached start scroll repeat anim loop
399
+ } // when hold timer is reached start scroll repeat anim loop
316
400
  // cancel it when mouse up happens anywhere
317
- _handleScrollButtonMouseDown: function _handleScrollButtonMouseDown(direction) {
401
+
402
+
403
+ _handleScrollButtonMouseDown(direction) {
318
404
  // closure so that scrollLeft is value at end of timer, and not start of timer
319
- this.holdTimer = setTimeout(function () {
320
- this._handleScrollRepeat(direction, this.tabsContainer.scrollLeft(), 100); // kickstart deltaX to be faster
405
+ this.holdTimer = window.setTimeout(() => {
406
+ var _this$tabsContainer$s5;
407
+
408
+ this._handleScrollRepeat(direction, (_this$tabsContainer$s5 = this.tabsContainer.scrollLeft()) !== null && _this$tabsContainer$s5 !== void 0 ? _this$tabsContainer$s5 : 0, 100); // kickstart deltaX to be faster
321
409
 
322
- }.bind(this), this.CLICK_TIMEOUT);
410
+ }, this.CLICK_TIMEOUT);
323
411
  window.addEventListener('mouseup', this._handleScrollButtonMouseUp);
324
- },
325
- // cancel scroll repeat
326
- _handleScrollButtonMouseUp: function _handleScrollButtonMouseUp() {
327
- this.holdTimer = clearTimeout(this.holdTimer);
328
- this.rAF = cancelAnimationFrame(this.rAF);
412
+ } // cancel scroll repeat
413
+
414
+
415
+ _handleScrollButtonMouseUp() {
416
+ var _this$holdTimer, _this$rAF4;
417
+
418
+ clearTimeout((_this$holdTimer = this.holdTimer) !== null && _this$holdTimer !== void 0 ? _this$holdTimer : -1);
419
+ this.holdTimer = null;
420
+ cancelAnimationFrame((_this$rAF4 = this.rAF) !== null && _this$rAF4 !== void 0 ? _this$rAF4 : -1);
421
+ this.rAF = null;
329
422
  window.removeEventListener('mouseup', this._handleScrollButtonMouseUp);
330
- },
331
- // disables scroll arrow if at edge of scroll area
332
- _checkScrollArrows: function _checkScrollArrows() {
423
+ } // disables scroll arrow if at edge of scroll area
424
+
425
+
426
+ _checkScrollArrows() {
427
+ var _this$tabsContainer$s6, _this$tabsContainer$i2, _this$tabsContainer$g7;
428
+
333
429
  if (this.tabsContainer.scrollLeft() === 0) {
334
- this.tabPreviousButton.first().attr('disabled', true);
335
- } else if (this.tabsContainer.scrollLeft() + this.tabsContainer.innerWidth() === this.tabsContainer.get(0).scrollWidth) {
336
- this.tabNextButton.attr('disabled', true);
430
+ this.tabPreviousButton.first().prop('disabled', true);
431
+ } else if (((_this$tabsContainer$s6 = this.tabsContainer.scrollLeft()) !== null && _this$tabsContainer$s6 !== void 0 ? _this$tabsContainer$s6 : 0) + ((_this$tabsContainer$i2 = this.tabsContainer.innerWidth()) !== null && _this$tabsContainer$i2 !== void 0 ? _this$tabsContainer$i2 : 0) === ((_this$tabsContainer$g7 = this.tabsContainer.get(0)) === null || _this$tabsContainer$g7 === void 0 ? void 0 : _this$tabsContainer$g7.scrollWidth)) {
432
+ this.tabNextButton.prop('disabled', true);
337
433
  } else {
338
- this.tabNextButton.attr('disabled', false);
339
- this.tabPreviousButton.first().attr('disabled', false);
434
+ this.tabNextButton.prop('disabled', false);
435
+ this.tabPreviousButton.first().prop('disabled', false);
340
436
  }
341
- },
342
- // scrolls the tab header container on drag tab over control buttons
437
+ } // scrolls the tab header container on drag tab over control buttons
343
438
  // or on press and hold of scroll arrows at either end
344
439
  // called recurisevly in an animation loop until cancelled
345
440
  // or directional end is reached
346
- _handleScrollRepeat: function _handleScrollRepeat(direction, startX, deltaX, prevTimestamp) {
347
- if (!deltaX) deltaX = 0;
348
- var tabContainerRect = this.tabsContainer.get(0).getBoundingClientRect();
441
+
442
+
443
+ _handleScrollRepeat(direction, startX) {
444
+ var _this$rAF5;
445
+
446
+ var deltaX = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
447
+ var prevTimestamp = arguments.length > 3 ? arguments[3] : undefined;
448
+ var tabContainer = this.tabsContainer.get(0);
449
+
450
+ if (!tabContainer) {
451
+ return;
452
+ }
453
+
454
+ var tabContainerRect = tabContainer.getBoundingClientRect();
349
455
 
350
456
  if (direction === this.SCROLL_LEFT) {
351
457
  this.tabsContainer.scrollLeft(startX - deltaX);
@@ -362,6 +468,8 @@ utils.copy(Header.prototype, {
362
468
  return;
363
469
  }
364
470
  } else if (direction === this.SCROLL_RIGHT) {
471
+ var _this$tabsContainer$s7, _this$tabsContainer$i3;
472
+
365
473
  this.tabsContainer.scrollLeft(startX + deltaX);
366
474
 
367
475
  if (this.isDraggingTab) {
@@ -370,7 +478,7 @@ utils.copy(Header.prototype, {
370
478
  } // stop loop at right edge
371
479
 
372
480
 
373
- if (this.tabsContainer.scrollLeft() + this.tabsContainer.innerWidth() === this.tabsContainer.get(0).scrollWidth) {
481
+ if (((_this$tabsContainer$s7 = this.tabsContainer.scrollLeft()) !== null && _this$tabsContainer$s7 !== void 0 ? _this$tabsContainer$s7 : 0) + ((_this$tabsContainer$i3 = this.tabsContainer.innerWidth()) !== null && _this$tabsContainer$i3 !== void 0 ? _this$tabsContainer$i3 : 0) === tabContainer.scrollWidth) {
374
482
  this._checkScrollArrows();
375
483
 
376
484
  return;
@@ -378,42 +486,39 @@ utils.copy(Header.prototype, {
378
486
  } // setup animation loop, scroll with acceleration
379
487
 
380
488
 
381
- window.cancelAnimationFrame(this.rAF);
382
- this.rAF = window.requestAnimationFrame(function (timestamp) {
489
+ window.cancelAnimationFrame((_this$rAF5 = this.rAF) !== null && _this$rAF5 !== void 0 ? _this$rAF5 : -1);
490
+ this.rAF = window.requestAnimationFrame(timestamp => {
491
+ var _this$tabsContainer$g8, _this$tabsContainer$g9;
492
+
383
493
  var startTime = prevTimestamp || timestamp;
384
494
  var deltaTime = timestamp - startTime;
385
495
  var newDeltaX = this.START_SPEED * deltaTime + 0.5 * this.ACCELERATION * (deltaTime * deltaTime);
386
- newDeltaX = Math.min(newDeltaX, this.tabsContainer.get(0).scrollWidth);
496
+ newDeltaX = Math.min(newDeltaX, (_this$tabsContainer$g8 = (_this$tabsContainer$g9 = this.tabsContainer.get(0)) === null || _this$tabsContainer$g9 === void 0 ? void 0 : _this$tabsContainer$g9.scrollWidth) !== null && _this$tabsContainer$g8 !== void 0 ? _this$tabsContainer$g8 : Infinity);
387
497
 
388
498
  this._handleScrollRepeat(direction, startX, newDeltaX, startTime);
389
- }.bind(this));
390
- },
391
-
499
+ });
500
+ }
392
501
  /**
393
502
  * Programmatically set closability.
394
- *
395
- * @package private
396
- * @param {Boolean} isClosable Whether to enable/disable closability.
397
- *
398
- * @returns {Boolean} Whether the action was successful
503
+ * @param isClosable Whether to enable/disable closability.
504
+ * @returns Whether the action was successful
399
505
  */
400
- _$setClosable: function _$setClosable(isClosable) {
506
+
507
+
508
+ _$setClosable(isClosable) {
401
509
  if (this.closeButton && this._isClosable()) {
402
510
  this.closeButton.element[isClosable ? 'show' : 'hide']();
403
511
  return true;
404
512
  }
405
513
 
406
514
  return false;
407
- },
408
-
515
+ }
409
516
  /**
410
517
  * Destroys the entire header
411
- *
412
- * @package private
413
- *
414
- * @returns {void}
415
518
  */
416
- _$destroy: function _$destroy() {
519
+
520
+
521
+ _$destroy() {
417
522
  this.emit('destroy', this);
418
523
 
419
524
  for (var i = 0; i < this.tabs.length; i++) {
@@ -428,24 +533,24 @@ utils.copy(Header.prototype, {
428
533
  this.tabDropdownSearch.off('input', this._handleFilterInput);
429
534
  this.tabDropdownSearch.off('keydown', this._handleFilterKeydown);
430
535
  this.element.remove();
431
- },
432
-
536
+ }
433
537
  /**
434
538
  * get settings from header
435
539
  *
436
- * @returns {string} when exists
540
+ * @returns when exists
437
541
  */
438
- _getHeaderSetting: function _getHeaderSetting(name) {
439
- if (name in this.parent._header) return this.parent._header[name];
440
- },
441
542
 
543
+
544
+ _getHeaderSetting(name) {
545
+ if (name in this.parent._header) return this.parent._header[name];
546
+ }
442
547
  /**
443
548
  * Creates the popout, maximise and close buttons in the header's top right corner
444
- *
445
- * @returns {void}
446
549
  */
447
- _createControls: function _createControls() {
448
- var closeStack, popout, label, maximiseLabel, minimiseLabel, maximise, maximiseButton, tabDropdownLabel, tabOverflowNextLabel, tabOverflowPreviousLabel;
550
+
551
+
552
+ _createControls() {
553
+ var closeStack, popout, label, maximise, tabDropdownLabel, tabOverflowNextLabel, tabOverflowPreviousLabel;
449
554
  /**
450
555
  * Dropdown to show additional tabs.
451
556
  */
@@ -462,7 +567,7 @@ utils.copy(Header.prototype, {
462
567
  */
463
568
 
464
569
  if (this._getHeaderSetting('popout')) {
465
- popout = utils.fnBind(this._onPopoutClick, this);
570
+ popout = this._onPopoutClick.bind(this);
466
571
  label = this._getHeaderSetting('popout');
467
572
  new HeaderButton(this, label, 'lm_popout', popout);
468
573
  }
@@ -472,15 +577,18 @@ utils.copy(Header.prototype, {
472
577
 
473
578
 
474
579
  if (this._getHeaderSetting('maximise')) {
475
- maximise = utils.fnBind(this.parent.toggleMaximise, this.parent);
476
- maximiseLabel = this._getHeaderSetting('maximise');
477
- minimiseLabel = this._getHeaderSetting('minimise');
478
- maximiseButton = new HeaderButton(this, maximiseLabel, 'lm_maximise', maximise);
580
+ maximise = this.parent.toggleMaximise.bind(this.parent);
581
+
582
+ var maximiseLabel = this._getHeaderSetting('maximise');
583
+
584
+ var minimiseLabel = this._getHeaderSetting('minimise');
585
+
586
+ var maximiseButton = new HeaderButton(this, maximiseLabel, 'lm_maximise', maximise);
479
587
  this.parent.on('maximised', function () {
480
- maximiseButton.element.attr('title', minimiseLabel);
588
+ maximiseButton.element.attr('title', minimiseLabel !== null && minimiseLabel !== void 0 ? minimiseLabel : '');
481
589
  });
482
590
  this.parent.on('minimised', function () {
483
- maximiseButton.element.attr('title', maximiseLabel);
591
+ maximiseButton.element.attr('title', maximiseLabel !== null && maximiseLabel !== void 0 ? maximiseLabel : '');
484
592
  });
485
593
  }
486
594
  /**
@@ -489,18 +597,19 @@ utils.copy(Header.prototype, {
489
597
 
490
598
 
491
599
  if (this._isClosable()) {
492
- closeStack = utils.fnBind(this.parent.remove, this.parent);
600
+ closeStack = this.parent.remove.bind(this.parent);
493
601
  label = this._getHeaderSetting('close');
494
602
  this.closeButton = new HeaderButton(this, label, 'lm_close', closeStack);
495
603
  }
496
- },
497
-
604
+ }
498
605
  /**
499
606
  * Shows drop down for additional tabs when there are too many to display.
500
607
  *
501
608
  * @returns {void}
502
609
  */
503
- _showAdditionalTabsDropdown: function _showAdditionalTabsDropdown() {
610
+
611
+
612
+ _showAdditionalTabsDropdown() {
504
613
  if (this.isDropdownShown) {
505
614
  this._hideAdditionalTabsDropdown();
506
615
 
@@ -524,9 +633,10 @@ utils.copy(Header.prototype, {
524
633
  $(document).on('mousedown', this._hideAdditionalTabsDropdown);
525
634
 
526
635
  this._updateAdditionalTabsDropdown();
527
- },
528
- // enables synthetic keyboard navigation of the list
529
- _handleFilterKeydown: function _handleFilterKeydown(e) {
636
+ } // enables synthetic keyboard navigation of the list
637
+
638
+
639
+ _handleFilterKeydown(e) {
530
640
  if (this.dropdownKeyIndex === -1) return;
531
641
 
532
642
  if (e.key === 'Escape') {
@@ -545,7 +655,7 @@ utils.copy(Header.prototype, {
545
655
  }
546
656
 
547
657
  function getNextDropdownIndex(startIndex, delta, tabDropdownList) {
548
- if (tabDropdownList.length < 2) {
658
+ if (tabDropdownList == null || tabDropdownList.length < 2) {
549
659
  return -1;
550
660
  }
551
661
 
@@ -564,25 +674,36 @@ utils.copy(Header.prototype, {
564
674
 
565
675
 
566
676
  if (e.key === 'ArrowDown' || e.key === 'Tab' && e.shiftKey === false) {
677
+ var _this$tabDropdownList, _this$tabDropdownList2;
678
+
567
679
  e.preventDefault();
568
- this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass('lm_keyboard_active');
680
+ (_this$tabDropdownList = this.tabDropdownList) === null || _this$tabDropdownList === void 0 ? void 0 : _this$tabDropdownList.eq(this.dropdownKeyIndex).removeClass('lm_keyboard_active');
569
681
  this.dropdownKeyIndex = getNextDropdownIndex(this.dropdownKeyIndex, 1, this.tabDropdownList);
570
- this.tabDropdownList.eq(this.dropdownKeyIndex).addClass('lm_keyboard_active');
682
+ (_this$tabDropdownList2 = this.tabDropdownList) === null || _this$tabDropdownList2 === void 0 ? void 0 : _this$tabDropdownList2.eq(this.dropdownKeyIndex).addClass('lm_keyboard_active');
571
683
  } else if (e.key === 'ArrowUp' || e.key === 'Tab') {
684
+ var _this$tabDropdownList3, _this$tabDropdownList4;
685
+
572
686
  e.preventDefault();
573
- this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass('lm_keyboard_active');
687
+ (_this$tabDropdownList3 = this.tabDropdownList) === null || _this$tabDropdownList3 === void 0 ? void 0 : _this$tabDropdownList3.eq(this.dropdownKeyIndex).removeClass('lm_keyboard_active');
574
688
  this.dropdownKeyIndex = getNextDropdownIndex(this.dropdownKeyIndex, -1, this.tabDropdownList);
575
- this.tabDropdownList.eq(this.dropdownKeyIndex).addClass('lm_keyboard_active');
689
+ (_this$tabDropdownList4 = this.tabDropdownList) === null || _this$tabDropdownList4 === void 0 ? void 0 : _this$tabDropdownList4.eq(this.dropdownKeyIndex).addClass('lm_keyboard_active');
576
690
  }
577
- },
578
- // filters the list
579
- _handleFilterInput: function _handleFilterInput(event) {
580
- // reset keyboard index
691
+ } // filters the list
692
+
693
+
694
+ _handleFilterInput(event) {
695
+ if (this.tabDropdownList == null) {
696
+ return;
697
+ } // reset keyboard index
698
+
699
+
581
700
  this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass('lm_keyboard_active');
582
701
  this.dropdownKeyIndex = -1;
583
702
 
584
703
  for (var i = 0; i < this.tabDropdownList.length; i++) {
585
- if (this.tabs[i].contentItem.config.title.toLowerCase().indexOf(event.target.value.toLowerCase()) !== -1) {
704
+ var _this$tabs$i$contentI, _this$tabs$i$contentI2;
705
+
706
+ if (((_this$tabs$i$contentI = (_this$tabs$i$contentI2 = this.tabs[i].contentItem.config.title) === null || _this$tabs$i$contentI2 === void 0 ? void 0 : _this$tabs$i$contentI2.toLowerCase().indexOf(event.target.value.toLowerCase())) !== null && _this$tabs$i$contentI !== void 0 ? _this$tabs$i$contentI : -1) !== -1) {
586
707
  this.tabDropdownList.eq(i).css('display', '');
587
708
  if (this.dropdownKeyIndex === -1) this.dropdownKeyIndex = i;
588
709
  } else {
@@ -593,23 +714,24 @@ utils.copy(Header.prototype, {
593
714
  if (this.dropdownKeyIndex !== -1) {
594
715
  this.tabDropdownList.eq(this.dropdownKeyIndex).addClass('lm_keyboard_active');
595
716
  }
596
- },
597
-
717
+ }
598
718
  /**
599
719
  * Hides drop down for additional tabs when needed. It is called via mousedown
600
720
  * event on document when list is open, or programmatically when drag starts,
601
721
  * or active tab changes etc.
602
- *
603
- * @returns {void}
604
722
  */
605
- _hideAdditionalTabsDropdown: function _hideAdditionalTabsDropdown(event) {
723
+
724
+
725
+ _hideAdditionalTabsDropdown(event) {
726
+ var _this$tabDropdownCont, _this$tabDropdownButt;
727
+
606
728
  // dropdown already closed, do nothing
607
729
  if (!this.isDropdownShown) return;
608
730
 
609
- if (event && this.tabDropdownContainer.get(0).contains(event.target)) {
731
+ if (event && (_this$tabDropdownCont = this.tabDropdownContainer.get(0)) !== null && _this$tabDropdownCont !== void 0 && _this$tabDropdownCont.contains(event.target)) {
610
732
  // prevent events occuring inside the list from causing a close
611
733
  return;
612
- } else if (event && this.tabDropdownButton.element.get(0) === event.target) {
734
+ } else if (event && ((_this$tabDropdownButt = this.tabDropdownButton) === null || _this$tabDropdownButt === void 0 ? void 0 : _this$tabDropdownButt.element.get(0)) === event.target) {
613
735
  // do nothing on the mouse down so that the click event can close, rather then re-open
614
736
  return;
615
737
  }
@@ -620,72 +742,87 @@ utils.copy(Header.prototype, {
620
742
 
621
743
  this.tabDropdownContainer.find('.lm_tabs').remove();
622
744
  $(document).off('mousedown', this._hideAdditionalTabsDropdown);
623
- },
624
-
745
+ }
625
746
  /**
626
747
  * Ensures additional tab drop down doesn't overflow screen, and instead becomes scrollable.
627
- *
628
- * @returns {void}
629
748
  */
630
- _updateAdditionalTabsDropdown: function _updateAdditionalTabsDropdown() {
749
+
750
+
751
+ _updateAdditionalTabsDropdown() {
752
+ var _this$tabDropdownCont2, _this$tabDropdownCont3, _$$scrollTop, _$$height;
753
+
631
754
  this.tabDropdownContainer.css('max-height', '');
632
755
  var h = this.tabDropdownContainer[0].scrollHeight;
633
756
  if (h === 0) return; // height can be zero if called on a hidden or empty list
634
757
 
635
- var y = this.tabDropdownContainer.offset().top - $(window).scrollTop(); // set max height of tab dropdown to be less then the viewport height - dropdown offset
758
+ var y = ((_this$tabDropdownCont2 = (_this$tabDropdownCont3 = this.tabDropdownContainer.offset()) === null || _this$tabDropdownCont3 === void 0 ? void 0 : _this$tabDropdownCont3.top) !== null && _this$tabDropdownCont2 !== void 0 ? _this$tabDropdownCont2 : 0) - ((_$$scrollTop = $(window).scrollTop()) !== null && _$$scrollTop !== void 0 ? _$$scrollTop : 0); // set max height of tab dropdown to be less then the viewport height - dropdown offset
636
759
 
637
- if (y + h > $(window).height()) {
638
- this.tabDropdownContainer.css('max-height', $(window).height() - y - 10); // 10 being a padding value
639
- }
640
- },
760
+ if (y + h > ((_$$height = $(window).height()) !== null && _$$height !== void 0 ? _$$height : 0)) {
761
+ var _$$height2;
641
762
 
763
+ this.tabDropdownContainer.css('max-height', ((_$$height2 = $(window).height()) !== null && _$$height2 !== void 0 ? _$$height2 : 0) - y - 10); // 10 being a padding value
764
+ }
765
+ }
642
766
  /**
643
767
  * Checks whether the header is closable based on the parent config and
644
768
  * the global config.
645
769
  *
646
- * @returns {Boolean} Whether the header is closable.
770
+ * @returns Whether the header is closable.
647
771
  */
648
- _isClosable: function _isClosable() {
649
- return this.parent.config.isClosable && this.layoutManager.config.settings.showCloseIcon;
650
- },
651
- _onPopoutClick: function _onPopoutClick() {
772
+
773
+
774
+ _isClosable() {
775
+ return Boolean(this.parent.config.isClosable && this.layoutManager.config.settings.showCloseIcon);
776
+ }
777
+
778
+ _onPopoutClick() {
652
779
  if (this.layoutManager.config.settings.popoutWholeStack === true) {
653
780
  this.parent.popout();
654
781
  } else {
655
- this.activeContentItem.popout();
656
- }
657
- },
782
+ var _this$activeContentIt;
658
783
 
784
+ (_this$activeContentIt = this.activeContentItem) === null || _this$activeContentIt === void 0 ? void 0 : _this$activeContentIt.popout();
785
+ }
786
+ }
659
787
  /**
660
788
  * Invoked when the header's background is clicked (not it's tabs or controls)
661
789
  *
662
- * @param {jQuery DOM event} event
663
- *
664
- * @returns {void}
790
+ * @param event
665
791
  */
666
- _onHeaderClick: function _onHeaderClick(event) {
792
+
793
+
794
+ _onHeaderClick(event) {
667
795
  if (event.target === this.element[0]) {
668
796
  this.parent.select();
669
797
  }
670
- },
671
-
798
+ }
672
799
  /**
673
800
  * Pushes the tabs to the tab dropdown if the available space is not sufficient
674
- *
675
- * @returns {void}
676
801
  */
677
- _updateTabSizes: function _updateTabSizes() {
802
+
803
+
804
+ _updateTabSizes() {
678
805
  if (this.tabs.length === 0) {
679
806
  return;
680
807
  }
681
808
 
682
- if (!this.isOverflowing && this.tabsContainer.get(0).scrollWidth > this.tabsContainer.get(0).clientWidth) {
683
- this.tabDropdownButton.element.show();
809
+ var tabsContainer = this.tabsContainer.get(0);
810
+
811
+ if (!tabsContainer) {
812
+ return;
813
+ }
814
+
815
+ if (!this.isOverflowing && tabsContainer.scrollWidth > tabsContainer.clientWidth) {
816
+ var _this$tabDropdownButt2;
817
+
818
+ (_this$tabDropdownButt2 = this.tabDropdownButton) === null || _this$tabDropdownButt2 === void 0 ? void 0 : _this$tabDropdownButt2.element.show();
684
819
  this.tabNextButton.show();
685
820
  this.tabPreviousButton.show();
686
821
  this.isOverflowing = true;
687
- } else if (this.isOverflowing && this.tabsContainer.get(0).scrollWidth <= this.tabsContainer.get(0).clientWidth) {
688
- this.tabDropdownButton.element.hide();
822
+ } else if (this.isOverflowing && tabsContainer.scrollWidth <= tabsContainer.clientWidth) {
823
+ var _this$tabDropdownButt3;
824
+
825
+ (_this$tabDropdownButt3 = this.tabDropdownButton) === null || _this$tabDropdownButt3 === void 0 ? void 0 : _this$tabDropdownButt3.element.hide();
689
826
  this.tabNextButton.hide();
690
827
  this.tabPreviousButton.hide();
691
828
  this.isOverflowing = false;
@@ -693,6 +830,12 @@ utils.copy(Header.prototype, {
693
830
 
694
831
  if (this.isOverflowing) this._checkScrollArrows();
695
832
  }
696
- });
697
- export default Header;
833
+
834
+ }
835
+
836
+ _defineProperty(Header, "_template", ['<div class="lm_header">', '<ul class="lm_tabs"></ul>', '<ul class="lm_controls"></ul>', '<ul class="lm_tabdropdown_list">', '<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>', '</ul>', '</div>'].join(''));
837
+
838
+ _defineProperty(Header, "_previousButtonTemplate", ['<ul class="lm_controls">', '<li class="lm_tabpreviousbutton"></li>', '</ul>'].join(''));
839
+
840
+ _defineProperty(Header, "_nextButtonTemplate", ['<li class="lm_tabnextbutton"></li>'].join(''));
698
841
  //# sourceMappingURL=Header.js.map