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