@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
|
@@ -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 { animFrame, BubblingEvent, EventEmitter } from "../utils/index.js";
|
|
4
3
|
import { ConfigurationError } from "../errors/index.js";
|
|
5
4
|
import { itemDefaultConfig } from "../config/index.js";
|
|
@@ -12,7 +11,6 @@ export function isComponent(item) {
|
|
|
12
11
|
export function isRoot(item) {
|
|
13
12
|
return item.isRoot;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
/**
|
|
17
15
|
* This is the baseclass that all content items inherit from.
|
|
18
16
|
* Most methods provide a subset of what the sub-classes do.
|
|
@@ -37,45 +35,27 @@ export function isRoot(item) {
|
|
|
37
35
|
export default class AbstractContentItem extends EventEmitter {
|
|
38
36
|
constructor(layoutManager, config, parent, element) {
|
|
39
37
|
super();
|
|
40
|
-
|
|
41
38
|
_defineProperty(this, "config", void 0);
|
|
42
|
-
|
|
43
39
|
_defineProperty(this, "type", void 0);
|
|
44
|
-
|
|
45
40
|
_defineProperty(this, "contentItems", void 0);
|
|
46
|
-
|
|
47
41
|
_defineProperty(this, "parent", void 0);
|
|
48
|
-
|
|
49
42
|
_defineProperty(this, "layoutManager", void 0);
|
|
50
|
-
|
|
51
43
|
_defineProperty(this, "element", void 0);
|
|
52
|
-
|
|
53
44
|
_defineProperty(this, "childElementContainer", void 0);
|
|
54
|
-
|
|
55
45
|
_defineProperty(this, "componentName", void 0);
|
|
56
|
-
|
|
57
46
|
_defineProperty(this, "isInitialised", false);
|
|
58
|
-
|
|
59
47
|
_defineProperty(this, "isMaximised", false);
|
|
60
|
-
|
|
61
48
|
_defineProperty(this, "isRoot", false);
|
|
62
|
-
|
|
63
49
|
_defineProperty(this, "isRow", false);
|
|
64
|
-
|
|
65
50
|
_defineProperty(this, "isColumn", false);
|
|
66
|
-
|
|
67
51
|
_defineProperty(this, "isStack", false);
|
|
68
|
-
|
|
69
52
|
_defineProperty(this, "isComponent", false);
|
|
70
|
-
|
|
71
53
|
_defineProperty(this, "tab", void 0);
|
|
72
|
-
|
|
73
54
|
_defineProperty(this, "_pendingEventPropagations", void 0);
|
|
74
|
-
|
|
75
55
|
_defineProperty(this, "_throttledEvents", void 0);
|
|
56
|
+
this.element = element;
|
|
76
57
|
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
// Some GL things expect this config to not change
|
|
79
59
|
this.config = this._extendItemNode(config);
|
|
80
60
|
this.type = config.type;
|
|
81
61
|
this.contentItems = [];
|
|
@@ -84,18 +64,17 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
84
64
|
this._pendingEventPropagations = {};
|
|
85
65
|
this._throttledEvents = ['stateChanged'];
|
|
86
66
|
this.on(EventEmitter.ALL_EVENT, this._propagateEvent, this);
|
|
87
|
-
|
|
88
67
|
if (config.content) {
|
|
89
68
|
this._createContentItems(config);
|
|
90
69
|
}
|
|
91
70
|
}
|
|
71
|
+
|
|
92
72
|
/**
|
|
93
73
|
* Set the size of the component and its children, called recursively
|
|
94
74
|
*
|
|
95
75
|
* @abstract
|
|
96
76
|
*/
|
|
97
77
|
|
|
98
|
-
|
|
99
78
|
/**
|
|
100
79
|
* Calls a method recursively downwards on the tree
|
|
101
80
|
*
|
|
@@ -108,76 +87,69 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
108
87
|
var functionArguments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
109
88
|
var bottomUp = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
110
89
|
var skipSelf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
111
|
-
|
|
112
90
|
if (bottomUp !== true && skipSelf !== true) {
|
|
113
91
|
this[functionName].apply(this, functionArguments);
|
|
114
92
|
}
|
|
115
|
-
|
|
116
93
|
for (var i = 0; i < this.contentItems.length; i++) {
|
|
117
94
|
this.contentItems[i].callDownwards(functionName, functionArguments, bottomUp);
|
|
118
95
|
}
|
|
119
|
-
|
|
120
96
|
if (bottomUp === true && skipSelf !== true) {
|
|
121
97
|
this[functionName].apply(this, functionArguments);
|
|
122
98
|
}
|
|
123
99
|
}
|
|
100
|
+
|
|
124
101
|
/**
|
|
125
102
|
* Removes a child node (and its children) from the tree
|
|
126
103
|
*
|
|
127
104
|
* @param contentItem
|
|
128
105
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
106
|
removeChild(contentItem) {
|
|
132
107
|
var _this$config$content;
|
|
133
|
-
|
|
134
108
|
var keepChild = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
135
|
-
|
|
136
109
|
/*
|
|
137
110
|
* Get the position of the item that's to be removed within all content items this node contains
|
|
138
111
|
*/
|
|
139
112
|
var index = this.contentItems.indexOf(contentItem);
|
|
113
|
+
|
|
140
114
|
/*
|
|
141
115
|
* Make sure the content item to be removed is actually a child of this item
|
|
142
116
|
*/
|
|
143
|
-
|
|
144
117
|
if (index === -1) {
|
|
145
118
|
throw new Error("Can't remove child item. Unknown content item");
|
|
146
119
|
}
|
|
120
|
+
|
|
147
121
|
/**
|
|
148
122
|
* Call ._$destroy on the content item. This also calls ._$destroy on all its children
|
|
149
123
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
124
|
if (keepChild !== true) {
|
|
153
125
|
this.contentItems[index]._$destroy();
|
|
154
126
|
}
|
|
127
|
+
|
|
155
128
|
/**
|
|
156
129
|
* Remove the content item from this nodes array of children
|
|
157
130
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
131
|
this.contentItems.splice(index, 1);
|
|
132
|
+
|
|
161
133
|
/**
|
|
162
134
|
* Remove the item from the configuration
|
|
163
135
|
*/
|
|
164
|
-
|
|
165
136
|
(_this$config$content = this.config.content) === null || _this$config$content === void 0 ? void 0 : _this$config$content.splice(index, 1);
|
|
137
|
+
|
|
166
138
|
/**
|
|
167
139
|
* If this node still contains other content items, adjust their size
|
|
168
140
|
*/
|
|
169
|
-
|
|
170
141
|
if (this.contentItems.length > 0) {
|
|
171
142
|
this.callDownwards('setSize');
|
|
143
|
+
|
|
172
144
|
/**
|
|
173
145
|
* If this was the last content item, remove this node as well
|
|
174
146
|
*/
|
|
175
147
|
} else if (this.type !== 'root' && this.config.isClosable) {
|
|
176
148
|
var _this$parent;
|
|
177
|
-
|
|
178
149
|
(_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.removeChild(this);
|
|
179
150
|
}
|
|
180
151
|
}
|
|
152
|
+
|
|
181
153
|
/**
|
|
182
154
|
* Sets up the tree structure for the newly added child
|
|
183
155
|
* The responsibility for the actual DOM manipulations lies
|
|
@@ -186,28 +158,22 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
186
158
|
* @param contentItem
|
|
187
159
|
* @param index If omitted item will be appended
|
|
188
160
|
*/
|
|
189
|
-
|
|
190
|
-
|
|
191
161
|
addChild(contentItem, index) {
|
|
192
162
|
contentItem = this.layoutManager._$normalizeContentItem(contentItem, this);
|
|
193
|
-
|
|
194
163
|
if (index === undefined) {
|
|
195
164
|
index = this.contentItems.length;
|
|
196
165
|
}
|
|
197
|
-
|
|
198
166
|
this.contentItems.splice(index, 0, contentItem);
|
|
199
|
-
|
|
200
167
|
if (this.config.content === undefined) {
|
|
201
168
|
this.config.content = [];
|
|
202
169
|
}
|
|
203
|
-
|
|
204
170
|
this.config.content.splice(index, 0, contentItem.config);
|
|
205
171
|
contentItem.parent = this;
|
|
206
|
-
|
|
207
172
|
if (contentItem.parent.isInitialised === true && contentItem.isInitialised === false) {
|
|
208
173
|
contentItem._$init();
|
|
209
174
|
}
|
|
210
175
|
}
|
|
176
|
+
|
|
211
177
|
/**
|
|
212
178
|
* Replaces oldChild with newChild. This used to use jQuery.replaceWith... which for
|
|
213
179
|
* some reason removes all event listeners, so isn't really an option.
|
|
@@ -215,130 +181,112 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
215
181
|
* @param oldChild
|
|
216
182
|
* @param newChild
|
|
217
183
|
*/
|
|
218
|
-
|
|
219
|
-
|
|
220
184
|
replaceChild(oldChild, newChild) {
|
|
221
185
|
var _$destroyOldChild = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
222
|
-
|
|
223
186
|
newChild = this.layoutManager._$normalizeContentItem(newChild);
|
|
224
187
|
var index = this.contentItems.indexOf(oldChild);
|
|
225
188
|
var parentNode = oldChild.element[0].parentNode;
|
|
226
|
-
|
|
227
189
|
if (index === -1) {
|
|
228
190
|
throw new Error("Can't replace child. oldChild is not child of this");
|
|
229
191
|
}
|
|
230
|
-
|
|
231
192
|
parentNode === null || parentNode === void 0 ? void 0 : parentNode.replaceChild(newChild.element[0], oldChild.element[0]);
|
|
193
|
+
|
|
232
194
|
/*
|
|
233
195
|
* Optionally destroy the old content item
|
|
234
196
|
*/
|
|
235
|
-
|
|
236
197
|
if (_$destroyOldChild === true) {
|
|
237
198
|
oldChild.parent = null;
|
|
238
|
-
|
|
239
199
|
oldChild._$destroy();
|
|
240
200
|
}
|
|
201
|
+
|
|
241
202
|
/*
|
|
242
203
|
* Wire the new contentItem into the tree
|
|
243
204
|
*/
|
|
244
|
-
|
|
245
|
-
|
|
246
205
|
this.contentItems[index] = newChild;
|
|
247
206
|
newChild.parent = this;
|
|
207
|
+
|
|
248
208
|
/*
|
|
249
209
|
* Update tab reference
|
|
250
210
|
*/
|
|
251
|
-
|
|
252
211
|
if (isStack(this)) {
|
|
253
212
|
this.header.tabs[index].contentItem = newChild;
|
|
254
|
-
}
|
|
255
|
-
|
|
213
|
+
}
|
|
256
214
|
|
|
215
|
+
//TODO This doesn't update the config... refactor to leave item nodes untouched after creation
|
|
257
216
|
if (newChild.parent.isInitialised === true && newChild.isInitialised === false) {
|
|
258
217
|
newChild._$init();
|
|
259
218
|
}
|
|
260
|
-
|
|
261
219
|
this.callDownwards('setSize');
|
|
262
220
|
}
|
|
221
|
+
|
|
263
222
|
/**
|
|
264
223
|
* Convenience method.
|
|
265
224
|
* Shorthand for this.parent.removeChild( this )
|
|
266
225
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
269
226
|
remove() {
|
|
270
227
|
var _this$parent2;
|
|
271
|
-
|
|
272
228
|
(_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.removeChild(this);
|
|
273
229
|
}
|
|
230
|
+
|
|
274
231
|
/**
|
|
275
232
|
* Removes the component from the layout and creates a new
|
|
276
233
|
* browser window with the component and its children inside
|
|
277
234
|
*/
|
|
278
|
-
|
|
279
|
-
|
|
280
235
|
popout() {
|
|
281
236
|
var browserPopout = this.layoutManager.createPopout(this);
|
|
282
237
|
this.emitBubblingEvent('stateChanged');
|
|
283
238
|
return browserPopout;
|
|
284
239
|
}
|
|
240
|
+
|
|
285
241
|
/**
|
|
286
242
|
* Maximises the Item or minimises it if it is already maximised
|
|
287
243
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
244
|
toggleMaximise(e) {
|
|
291
245
|
e && e.preventDefault();
|
|
292
|
-
|
|
293
246
|
if (this.isMaximised === true) {
|
|
294
247
|
this.layoutManager._$minimiseItem(this);
|
|
295
248
|
} else {
|
|
296
249
|
this.layoutManager._$maximiseItem(this);
|
|
297
250
|
}
|
|
298
|
-
|
|
299
251
|
this.isMaximised = !this.isMaximised;
|
|
300
252
|
this.emitBubblingEvent('stateChanged');
|
|
301
253
|
}
|
|
254
|
+
|
|
302
255
|
/**
|
|
303
256
|
* Selects the item if it is not already selected
|
|
304
257
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
258
|
select() {
|
|
308
259
|
if (this.layoutManager.selectedItem !== this) {
|
|
309
260
|
this.layoutManager.selectItem(this, true);
|
|
310
261
|
this.element.addClass('lm_selected');
|
|
311
262
|
}
|
|
312
263
|
}
|
|
264
|
+
|
|
313
265
|
/**
|
|
314
266
|
* De-selects the item if it is selected
|
|
315
267
|
*/
|
|
316
|
-
|
|
317
|
-
|
|
318
268
|
deselect() {
|
|
319
269
|
if (this.layoutManager.selectedItem === this) {
|
|
320
270
|
this.layoutManager.selectedItem = null;
|
|
321
271
|
this.element.removeClass('lm_selected');
|
|
322
272
|
}
|
|
323
273
|
}
|
|
274
|
+
|
|
324
275
|
/**
|
|
325
276
|
* Set this component's title
|
|
326
277
|
* @param title
|
|
327
278
|
*/
|
|
328
|
-
|
|
329
|
-
|
|
330
279
|
setTitle(title) {
|
|
331
280
|
this.config.title = title;
|
|
332
281
|
this.emit('titleChanged', title);
|
|
333
282
|
this.emitBubblingEvent('stateChanged');
|
|
334
283
|
}
|
|
284
|
+
|
|
335
285
|
/**
|
|
336
286
|
* Checks whether a provided id is present
|
|
337
287
|
* @param id
|
|
338
288
|
* @returns isPresent
|
|
339
289
|
*/
|
|
340
|
-
|
|
341
|
-
|
|
342
290
|
hasId(id) {
|
|
343
291
|
if (!this.config.id) {
|
|
344
292
|
return false;
|
|
@@ -348,18 +296,16 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
348
296
|
return this.config.id.indexOf(id) !== -1;
|
|
349
297
|
}
|
|
350
298
|
}
|
|
299
|
+
|
|
351
300
|
/**
|
|
352
301
|
* Adds an id. Adds it as a string if the component doesn't
|
|
353
302
|
* have an id yet or creates/uses an array
|
|
354
303
|
* @param id
|
|
355
304
|
*/
|
|
356
|
-
|
|
357
|
-
|
|
358
305
|
addId(id) {
|
|
359
306
|
if (this.hasId(id)) {
|
|
360
307
|
return;
|
|
361
308
|
}
|
|
362
|
-
|
|
363
309
|
if (!this.config.id) {
|
|
364
310
|
this.config.id = id;
|
|
365
311
|
} else if (typeof this.config.id === 'string') {
|
|
@@ -368,18 +314,16 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
368
314
|
this.config.id.push(id);
|
|
369
315
|
}
|
|
370
316
|
}
|
|
317
|
+
|
|
371
318
|
/**
|
|
372
319
|
* Removes an existing id. Throws an error
|
|
373
320
|
* if the id is not present
|
|
374
321
|
* @param id
|
|
375
322
|
*/
|
|
376
|
-
|
|
377
|
-
|
|
378
323
|
removeId(id) {
|
|
379
324
|
if (!this.hasId(id)) {
|
|
380
325
|
throw new Error('Id not found');
|
|
381
326
|
}
|
|
382
|
-
|
|
383
327
|
if (typeof this.config.id === 'string') {
|
|
384
328
|
delete this.config.id;
|
|
385
329
|
} else if (this.config.id instanceof Array) {
|
|
@@ -387,28 +331,23 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
387
331
|
this.config.id.splice(index, 1);
|
|
388
332
|
}
|
|
389
333
|
}
|
|
334
|
+
|
|
390
335
|
/****************************************
|
|
391
336
|
* SELECTOR
|
|
392
337
|
****************************************/
|
|
393
|
-
|
|
394
|
-
|
|
395
338
|
getItemsByFilter(filter) {
|
|
396
339
|
var result = [];
|
|
397
|
-
|
|
398
340
|
var next = function next(contentItem) {
|
|
399
341
|
for (var i = 0; i < contentItem.contentItems.length; i++) {
|
|
400
342
|
if (filter(contentItem.contentItems[i]) === true) {
|
|
401
343
|
result.push(contentItem.contentItems[i]);
|
|
402
344
|
}
|
|
403
|
-
|
|
404
345
|
next(contentItem.contentItems[i]);
|
|
405
346
|
}
|
|
406
347
|
};
|
|
407
|
-
|
|
408
348
|
next(this);
|
|
409
349
|
return result;
|
|
410
350
|
}
|
|
411
|
-
|
|
412
351
|
getItemsById(id) {
|
|
413
352
|
return this.getItemsByFilter(function (item) {
|
|
414
353
|
if (item.config.id instanceof Array) {
|
|
@@ -418,84 +357,67 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
418
357
|
}
|
|
419
358
|
});
|
|
420
359
|
}
|
|
421
|
-
|
|
422
360
|
getItemsByType(type) {
|
|
423
361
|
return this._$getItemsByProperty('type', type);
|
|
424
362
|
}
|
|
425
|
-
|
|
426
363
|
getComponentsByName(componentName) {
|
|
427
364
|
var components = this._$getItemsByProperty('componentName', componentName);
|
|
428
|
-
|
|
429
365
|
var instances = [];
|
|
430
|
-
|
|
431
366
|
for (var i = 0; i < components.length; i++) {
|
|
432
367
|
instances.push(components[i].instance);
|
|
433
368
|
}
|
|
434
|
-
|
|
435
369
|
return instances;
|
|
436
370
|
}
|
|
371
|
+
|
|
437
372
|
/****************************************
|
|
438
373
|
* PACKAGE PRIVATE
|
|
439
374
|
****************************************/
|
|
440
|
-
|
|
441
|
-
|
|
442
375
|
_$getItemsByProperty(key, value) {
|
|
443
376
|
return this.getItemsByFilter(function (item) {
|
|
444
377
|
return item[key] === value;
|
|
445
378
|
});
|
|
446
379
|
}
|
|
447
|
-
|
|
448
380
|
_$setParent(parent) {
|
|
449
381
|
this.parent = parent;
|
|
450
382
|
}
|
|
451
|
-
|
|
452
383
|
_$highlightDropZone(x, y, area) {
|
|
453
384
|
var _this$layoutManager$d;
|
|
454
|
-
|
|
455
385
|
(_this$layoutManager$d = this.layoutManager.dropTargetIndicator) === null || _this$layoutManager$d === void 0 ? void 0 : _this$layoutManager$d.highlightArea(area);
|
|
456
386
|
}
|
|
457
|
-
|
|
458
387
|
_$onDrop(contentItem, area) {
|
|
459
388
|
this.addChild(contentItem);
|
|
460
389
|
}
|
|
461
|
-
|
|
462
390
|
_$hide() {
|
|
463
391
|
this._callOnActiveComponents('hide');
|
|
464
|
-
|
|
465
392
|
this.element.hide();
|
|
466
393
|
this.layoutManager.updateSize();
|
|
467
394
|
}
|
|
468
|
-
|
|
469
395
|
_$show() {
|
|
470
396
|
this._callOnActiveComponents('show');
|
|
471
|
-
|
|
472
397
|
this.element.show();
|
|
473
398
|
this.layoutManager.updateSize();
|
|
474
399
|
}
|
|
475
|
-
|
|
476
400
|
_callOnActiveComponents(methodName) {
|
|
477
401
|
var stacks = this.getItemsByType('stack');
|
|
478
402
|
var activeContentItem = null;
|
|
479
|
-
|
|
480
403
|
for (var i = 0; i < stacks.length; i++) {
|
|
481
404
|
activeContentItem = stacks[i].getActiveContentItem();
|
|
482
|
-
|
|
483
405
|
if (activeContentItem && isComponent(activeContentItem)) {
|
|
484
406
|
activeContentItem.container[methodName]();
|
|
485
407
|
}
|
|
486
408
|
}
|
|
487
409
|
}
|
|
410
|
+
|
|
488
411
|
/**
|
|
489
412
|
* Destroys this item ands its children
|
|
490
413
|
*/
|
|
491
|
-
|
|
492
|
-
|
|
493
414
|
_$destroy() {
|
|
494
415
|
this.emitBubblingEvent('beforeItemDestroyed');
|
|
495
416
|
this.callDownwards('_$destroy', [], true, true);
|
|
496
417
|
this.element.remove();
|
|
497
418
|
this.emitBubblingEvent('itemDestroyed');
|
|
498
419
|
}
|
|
420
|
+
|
|
499
421
|
/**
|
|
500
422
|
* Returns the area the component currently occupies in the format
|
|
501
423
|
*
|
|
@@ -507,11 +429,8 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
507
429
|
* contentItem: contentItem
|
|
508
430
|
* }
|
|
509
431
|
*/
|
|
510
|
-
|
|
511
|
-
|
|
512
432
|
_$getArea(element) {
|
|
513
433
|
var _element$offset, _element$width, _element$height;
|
|
514
|
-
|
|
515
434
|
element = element || this.element;
|
|
516
435
|
var offset = (_element$offset = element.offset()) !== null && _element$offset !== void 0 ? _element$offset : {
|
|
517
436
|
left: 0,
|
|
@@ -529,6 +448,7 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
529
448
|
side: ''
|
|
530
449
|
};
|
|
531
450
|
}
|
|
451
|
+
|
|
532
452
|
/**
|
|
533
453
|
* The tree of content items is created in two steps: First all content items are instantiated,
|
|
534
454
|
* then init is called recursively from top to bottem. This is the basic init function,
|
|
@@ -536,70 +456,59 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
536
456
|
*
|
|
537
457
|
* Its behaviour depends on the content item
|
|
538
458
|
*/
|
|
539
|
-
|
|
540
|
-
|
|
541
459
|
_$init() {
|
|
542
460
|
this.setSize();
|
|
543
|
-
|
|
544
461
|
for (var i = 0; i < this.contentItems.length; i++) {
|
|
545
462
|
var _this$childElementCon;
|
|
546
|
-
|
|
547
463
|
(_this$childElementCon = this.childElementContainer) === null || _this$childElementCon === void 0 ? void 0 : _this$childElementCon.append(this.contentItems[i].element);
|
|
548
464
|
}
|
|
549
|
-
|
|
550
465
|
this.isInitialised = true;
|
|
551
466
|
this.emitBubblingEvent('itemCreated');
|
|
552
467
|
this.emitBubblingEvent(this.type + 'Created');
|
|
553
468
|
}
|
|
469
|
+
|
|
554
470
|
/**
|
|
555
471
|
* Emit an event that bubbles up the item tree.
|
|
556
472
|
*
|
|
557
473
|
* @param name The name of the event
|
|
558
474
|
*/
|
|
559
|
-
|
|
560
|
-
|
|
561
475
|
emitBubblingEvent(name) {
|
|
562
476
|
var event = new BubblingEvent(name, this);
|
|
563
477
|
this.emit(name, event);
|
|
564
478
|
}
|
|
479
|
+
|
|
565
480
|
/**
|
|
566
481
|
* Private method, creates all content items for this node at initialisation time
|
|
567
482
|
* PLEASE NOTE, please see addChild for adding contentItems add runtime
|
|
568
483
|
* @param {configuration item node} config
|
|
569
484
|
*/
|
|
570
|
-
|
|
571
|
-
|
|
572
485
|
_createContentItems(config) {
|
|
573
486
|
var oContentItem;
|
|
574
|
-
|
|
575
487
|
if (!(config.content instanceof Array)) {
|
|
576
488
|
throw new ConfigurationError('content must be an Array', config);
|
|
577
489
|
}
|
|
578
|
-
|
|
579
490
|
for (var i = 0; i < config.content.length; i++) {
|
|
580
491
|
oContentItem = this.layoutManager.createContentItem(config.content[i], this);
|
|
581
492
|
this.contentItems.push(oContentItem);
|
|
582
493
|
}
|
|
583
494
|
}
|
|
495
|
+
|
|
584
496
|
/**
|
|
585
497
|
* Extends an item configuration node with default settings
|
|
586
498
|
* @param config
|
|
587
499
|
* @returns extended config
|
|
588
500
|
*/
|
|
589
|
-
|
|
590
|
-
|
|
591
501
|
_extendItemNode(config) {
|
|
592
502
|
for (var [key, value] of Object.entries(itemDefaultConfig)) {
|
|
593
503
|
// This just appeases TS
|
|
594
504
|
var k = key;
|
|
595
|
-
|
|
596
505
|
if (config[k] === undefined) {
|
|
597
506
|
config[k] = value;
|
|
598
507
|
}
|
|
599
508
|
}
|
|
600
|
-
|
|
601
509
|
return config;
|
|
602
510
|
}
|
|
511
|
+
|
|
603
512
|
/**
|
|
604
513
|
* Called for every event on the item tree. Decides whether the event is a bubbling
|
|
605
514
|
* event and propagates it to its parent
|
|
@@ -607,8 +516,6 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
607
516
|
* @param name the name of the event
|
|
608
517
|
* @param event
|
|
609
518
|
*/
|
|
610
|
-
|
|
611
|
-
|
|
612
519
|
_propagateEvent(name, event) {
|
|
613
520
|
if (event instanceof BubblingEvent && event.isPropagationStopped === false && this.isInitialised === true) {
|
|
614
521
|
/**
|
|
@@ -624,6 +531,7 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
624
531
|
}
|
|
625
532
|
}
|
|
626
533
|
}
|
|
534
|
+
|
|
627
535
|
/**
|
|
628
536
|
* All raw events bubble up to the root element. Some events that
|
|
629
537
|
* are propagated to - and emitted by - the layoutManager however are
|
|
@@ -631,8 +539,6 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
631
539
|
*
|
|
632
540
|
* @param name the name of the event
|
|
633
541
|
*/
|
|
634
|
-
|
|
635
|
-
|
|
636
542
|
_scheduleEventPropagationToLayoutManager(name, event) {
|
|
637
543
|
if (this._throttledEvents.indexOf(name) === -1) {
|
|
638
544
|
this.layoutManager.emit(name, event.origin);
|
|
@@ -643,17 +549,15 @@ export default class AbstractContentItem extends EventEmitter {
|
|
|
643
549
|
}
|
|
644
550
|
}
|
|
645
551
|
}
|
|
552
|
+
|
|
646
553
|
/**
|
|
647
554
|
* Callback for events scheduled by _scheduleEventPropagationToLayoutManager
|
|
648
555
|
*
|
|
649
556
|
* @param name the name of the event
|
|
650
557
|
*/
|
|
651
|
-
|
|
652
|
-
|
|
653
558
|
_propagateEventToLayoutManager(name, event) {
|
|
654
559
|
this._pendingEventPropagations[name] = false;
|
|
655
560
|
this.layoutManager.emit(name, event);
|
|
656
561
|
}
|
|
657
|
-
|
|
658
562
|
}
|
|
659
563
|
//# sourceMappingURL=AbstractContentItem.js.map
|