@deephaven/golden-layout 0.17.1-beta.2 → 0.17.1-beta.4

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 (73) hide show
  1. package/dist/LayoutManager.js +1140 -0
  2. package/dist/LayoutManager.js.map +1 -0
  3. package/dist/base.js +16 -0
  4. package/dist/base.js.map +1 -0
  5. package/dist/config/ItemDefaultConfig.js +8 -0
  6. package/dist/config/ItemDefaultConfig.js.map +1 -0
  7. package/dist/config/defaultConfig.js +42 -0
  8. package/dist/config/defaultConfig.js.map +1 -0
  9. package/dist/config/index.js +7 -0
  10. package/dist/config/index.js.map +1 -0
  11. package/dist/container/ItemContainer.js +192 -0
  12. package/dist/container/ItemContainer.js.map +1 -0
  13. package/dist/container/index.js +5 -0
  14. package/dist/container/index.js.map +1 -0
  15. package/dist/controls/BrowserPopout.js +260 -0
  16. package/dist/controls/BrowserPopout.js.map +1 -0
  17. package/dist/controls/DragProxy.js +236 -0
  18. package/dist/controls/DragProxy.js.map +1 -0
  19. package/dist/controls/DragSource.js +60 -0
  20. package/dist/controls/DragSource.js.map +1 -0
  21. package/dist/controls/DragSourceFromEvent.js +75 -0
  22. package/dist/controls/DragSourceFromEvent.js.map +1 -0
  23. package/dist/controls/DropTargetIndicator.js +28 -0
  24. package/dist/controls/DropTargetIndicator.js.map +1 -0
  25. package/dist/controls/Header.js +698 -0
  26. package/dist/controls/Header.js.map +1 -0
  27. package/dist/controls/HeaderButton.js +23 -0
  28. package/dist/controls/HeaderButton.js.map +1 -0
  29. package/dist/controls/Splitter.js +45 -0
  30. package/dist/controls/Splitter.js.map +1 -0
  31. package/dist/controls/Tab.js +259 -0
  32. package/dist/controls/Tab.js.map +1 -0
  33. package/dist/controls/TransitionIndicator.js +64 -0
  34. package/dist/controls/TransitionIndicator.js.map +1 -0
  35. package/dist/controls/index.js +23 -0
  36. package/dist/controls/index.js.map +1 -0
  37. package/dist/errors/ConfigurationError.js +10 -0
  38. package/dist/errors/ConfigurationError.js.map +1 -0
  39. package/dist/errors/index.js +5 -0
  40. package/dist/errors/index.js.map +1 -0
  41. package/dist/index.js +3 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/items/AbstractContentItem.js +617 -0
  44. package/dist/items/AbstractContentItem.js.map +1 -0
  45. package/dist/items/Component.js +84 -0
  46. package/dist/items/Component.js.map +1 -0
  47. package/dist/items/Root.js +93 -0
  48. package/dist/items/Root.js.map +1 -0
  49. package/dist/items/RowOrColumn.js +550 -0
  50. package/dist/items/RowOrColumn.js.map +1 -0
  51. package/dist/items/Stack.js +498 -0
  52. package/dist/items/Stack.js.map +1 -0
  53. package/dist/items/index.js +13 -0
  54. package/dist/items/index.js.map +1 -0
  55. package/dist/utils/BubblingEvent.js +12 -0
  56. package/dist/utils/BubblingEvent.js.map +1 -0
  57. package/dist/utils/ConfigMinifier.js +160 -0
  58. package/dist/utils/ConfigMinifier.js.map +1 -0
  59. package/dist/utils/DragListener.js +128 -0
  60. package/dist/utils/DragListener.js.map +1 -0
  61. package/dist/utils/EventEmitter.js +133 -0
  62. package/dist/utils/EventEmitter.js.map +1 -0
  63. package/dist/utils/EventHub.js +147 -0
  64. package/dist/utils/EventHub.js.map +1 -0
  65. package/dist/utils/ReactComponentHandler.js +135 -0
  66. package/dist/utils/ReactComponentHandler.js.map +1 -0
  67. package/dist/utils/index.js +22 -0
  68. package/dist/utils/index.js.map +1 -0
  69. package/dist/utils/utils.js +195 -0
  70. package/dist/utils/utils.js.map +1 -0
  71. package/package.json +20 -47
  72. package/dist/goldenlayout.js +0 -6314
  73. package/dist/goldenlayout.min.js +0 -1
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import LayoutManager from './LayoutManager.js';
2
+ export default LayoutManager;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["LayoutManager"],"sources":["../src/index.js"],"sourcesContent":["import LayoutManager from './LayoutManager.js';\n\nexport default LayoutManager;\n"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,oBAA1B;AAEA,eAAeA,aAAf"}
@@ -0,0 +1,617 @@
1
+ import utils from '../utils/index.js';
2
+ import errors from '../errors/index.js';
3
+ import config from '../config/index.js';
4
+ var {
5
+ itemDefaultConfig
6
+ } = config;
7
+ /**
8
+ * This is the baseclass that all content items inherit from.
9
+ * Most methods provide a subset of what the sub-classes do.
10
+ *
11
+ * It also provides a number of functions for tree traversal
12
+ *
13
+ * @param {lm.LayoutManager} layoutManager
14
+ * @param {item node configuration} config
15
+ * @param {lm.item} parent
16
+ *
17
+ * @event stateChanged
18
+ * @event beforeItemDestroyed
19
+ * @event itemDestroyed
20
+ * @event itemCreated
21
+ * @event componentCreated
22
+ * @event rowCreated
23
+ * @event columnCreated
24
+ * @event stackCreated
25
+ *
26
+ * @constructor
27
+ */
28
+
29
+ var AbstractContentItem = function AbstractContentItem(layoutManager, config, parent) {
30
+ utils.EventEmitter.call(this);
31
+ this.config = this._extendItemNode(config);
32
+ this.type = config.type;
33
+ this.contentItems = [];
34
+ this.parent = parent;
35
+ this.isInitialised = false;
36
+ this.isMaximised = false;
37
+ this.isRoot = false;
38
+ this.isRow = false;
39
+ this.isColumn = false;
40
+ this.isStack = false;
41
+ this.isComponent = false;
42
+ this.layoutManager = layoutManager;
43
+ this._pendingEventPropagations = {};
44
+ this._throttledEvents = ['stateChanged'];
45
+ this.on(utils.EventEmitter.ALL_EVENT, this._propagateEvent, this);
46
+
47
+ if (config.content) {
48
+ this._createContentItems(config);
49
+ }
50
+ };
51
+
52
+ utils.copy(AbstractContentItem.prototype, {
53
+ /**
54
+ * Set the size of the component and its children, called recursively
55
+ *
56
+ * @abstract
57
+ * @returns void
58
+ */
59
+ setSize: function setSize() {
60
+ throw new Error('Abstract Method');
61
+ },
62
+
63
+ /**
64
+ * Calls a method recursively downwards on the tree
65
+ *
66
+ * @param {String} functionName the name of the function to be called
67
+ * @param {[Array]}functionArguments optional arguments that are passed to every function
68
+ * @param {[bool]} bottomUp Call methods from bottom to top, defaults to false
69
+ * @param {[bool]} skipSelf Don't invoke the method on the class that calls it, defaults to false
70
+ *
71
+ * @returns {void}
72
+ */
73
+ callDownwards: function callDownwards(functionName, functionArguments, bottomUp, skipSelf) {
74
+ var i;
75
+
76
+ if (bottomUp !== true && skipSelf !== true) {
77
+ this[functionName].apply(this, functionArguments || []);
78
+ }
79
+
80
+ for (i = 0; i < this.contentItems.length; i++) {
81
+ this.contentItems[i].callDownwards(functionName, functionArguments, bottomUp);
82
+ }
83
+
84
+ if (bottomUp === true && skipSelf !== true) {
85
+ this[functionName].apply(this, functionArguments || []);
86
+ }
87
+ },
88
+
89
+ /**
90
+ * Removes a child node (and its children) from the tree
91
+ *
92
+ * @param {lm.items.ContentItem} contentItem
93
+ *
94
+ * @returns {void}
95
+ */
96
+ removeChild: function removeChild(contentItem, keepChild) {
97
+ /*
98
+ * Get the position of the item that's to be removed within all content items this node contains
99
+ */
100
+ var index = utils.indexOf(contentItem, this.contentItems);
101
+ /*
102
+ * Make sure the content item to be removed is actually a child of this item
103
+ */
104
+
105
+ if (index === -1) {
106
+ throw new Error("Can't remove child item. Unknown content item");
107
+ }
108
+ /**
109
+ * Call ._$destroy on the content item. This also calls ._$destroy on all its children
110
+ */
111
+
112
+
113
+ if (keepChild !== true) {
114
+ this.contentItems[index]._$destroy();
115
+ }
116
+ /**
117
+ * Remove the content item from this nodes array of children
118
+ */
119
+
120
+
121
+ this.contentItems.splice(index, 1);
122
+ /**
123
+ * Remove the item from the configuration
124
+ */
125
+
126
+ this.config.content.splice(index, 1);
127
+ /**
128
+ * If this node still contains other content items, adjust their size
129
+ */
130
+
131
+ if (this.contentItems.length > 0) {
132
+ this.callDownwards('setSize');
133
+ /**
134
+ * If this was the last content item, remove this node as well
135
+ */
136
+ } else if (this.type !== 'root' && this.config.isClosable) {
137
+ this.parent.removeChild(this);
138
+ }
139
+ },
140
+
141
+ /**
142
+ * Sets up the tree structure for the newly added child
143
+ * The responsibility for the actual DOM manipulations lies
144
+ * with the concrete item
145
+ *
146
+ * @param {lm.items.AbstractContentItem} contentItem
147
+ * @param {[Int]} index If omitted item will be appended
148
+ */
149
+ addChild: function addChild(contentItem, index) {
150
+ if (index === undefined) {
151
+ index = this.contentItems.length;
152
+ }
153
+
154
+ this.contentItems.splice(index, 0, contentItem);
155
+
156
+ if (this.config.content === undefined) {
157
+ this.config.content = [];
158
+ }
159
+
160
+ this.config.content.splice(index, 0, contentItem.config);
161
+ contentItem.parent = this;
162
+
163
+ if (contentItem.parent.isInitialised === true && contentItem.isInitialised === false) {
164
+ contentItem._$init();
165
+ }
166
+ },
167
+
168
+ /**
169
+ * Replaces oldChild with newChild. This used to use jQuery.replaceWith... which for
170
+ * some reason removes all event listeners, so isn't really an option.
171
+ *
172
+ * @param {lm.item.AbstractContentItem} oldChild
173
+ * @param {lm.item.AbstractContentItem} newChild
174
+ *
175
+ * @returns {void}
176
+ */
177
+ replaceChild: function replaceChild(oldChild, newChild, _$destroyOldChild) {
178
+ newChild = this.layoutManager._$normalizeContentItem(newChild);
179
+ var index = utils.indexOf(oldChild, this.contentItems),
180
+ parentNode = oldChild.element[0].parentNode;
181
+
182
+ if (index === -1) {
183
+ throw new Error("Can't replace child. oldChild is not child of this");
184
+ }
185
+
186
+ parentNode.replaceChild(newChild.element[0], oldChild.element[0]);
187
+ /*
188
+ * Optionally destroy the old content item
189
+ */
190
+
191
+ if (_$destroyOldChild === true) {
192
+ oldChild.parent = null;
193
+
194
+ oldChild._$destroy();
195
+ }
196
+ /*
197
+ * Wire the new contentItem into the tree
198
+ */
199
+
200
+
201
+ this.contentItems[index] = newChild;
202
+ newChild.parent = this;
203
+ /*
204
+ * Update tab reference
205
+ */
206
+
207
+ if (this.isStack) {
208
+ this.header.tabs[index].contentItem = newChild;
209
+ } //TODO This doesn't update the config... refactor to leave item nodes untouched after creation
210
+
211
+
212
+ if (newChild.parent.isInitialised === true && newChild.isInitialised === false) {
213
+ newChild._$init();
214
+ }
215
+
216
+ this.callDownwards('setSize');
217
+ },
218
+
219
+ /**
220
+ * Convenience method.
221
+ * Shorthand for this.parent.removeChild( this )
222
+ *
223
+ * @returns {void}
224
+ */
225
+ remove: function remove() {
226
+ this.parent.removeChild(this);
227
+ },
228
+
229
+ /**
230
+ * Removes the component from the layout and creates a new
231
+ * browser window with the component and its children inside
232
+ *
233
+ * @returns {lm.controls.BrowserPopout}
234
+ */
235
+ popout: function popout() {
236
+ var browserPopout = this.layoutManager.createPopout(this);
237
+ this.emitBubblingEvent('stateChanged');
238
+ return browserPopout;
239
+ },
240
+
241
+ /**
242
+ * Maximises the Item or minimises it if it is already maximised
243
+ *
244
+ * @returns {void}
245
+ */
246
+ toggleMaximise: function toggleMaximise(e) {
247
+ e && e.preventDefault();
248
+
249
+ if (this.isMaximised === true) {
250
+ this.layoutManager._$minimiseItem(this);
251
+ } else {
252
+ this.layoutManager._$maximiseItem(this);
253
+ }
254
+
255
+ this.isMaximised = !this.isMaximised;
256
+ this.emitBubblingEvent('stateChanged');
257
+ },
258
+
259
+ /**
260
+ * Selects the item if it is not already selected
261
+ *
262
+ * @returns {void}
263
+ */
264
+ select: function select() {
265
+ if (this.layoutManager.selectedItem !== this) {
266
+ this.layoutManager.selectItem(this, true);
267
+ this.element.addClass('lm_selected');
268
+ }
269
+ },
270
+
271
+ /**
272
+ * De-selects the item if it is selected
273
+ *
274
+ * @returns {void}
275
+ */
276
+ deselect: function deselect() {
277
+ if (this.layoutManager.selectedItem === this) {
278
+ this.layoutManager.selectedItem = null;
279
+ this.element.removeClass('lm_selected');
280
+ }
281
+ },
282
+
283
+ /**
284
+ * Set this component's title
285
+ *
286
+ * @public
287
+ * @param {String} title
288
+ *
289
+ * @returns {void}
290
+ */
291
+ setTitle: function setTitle(title) {
292
+ this.config.title = title;
293
+ this.emit('titleChanged', title);
294
+ this.emitBubblingEvent('stateChanged');
295
+ },
296
+
297
+ /**
298
+ * Checks whether a provided id is present
299
+ *
300
+ * @public
301
+ * @param {String} id
302
+ *
303
+ * @returns {Boolean} isPresent
304
+ */
305
+ hasId: function hasId(id) {
306
+ if (!this.config.id) {
307
+ return false;
308
+ } else if (typeof this.config.id === 'string') {
309
+ return this.config.id === id;
310
+ } else if (this.config.id instanceof Array) {
311
+ return utils.indexOf(id, this.config.id) !== -1;
312
+ }
313
+ },
314
+
315
+ /**
316
+ * Adds an id. Adds it as a string if the component doesn't
317
+ * have an id yet or creates/uses an array
318
+ *
319
+ * @public
320
+ * @param {String} id
321
+ *
322
+ * @returns {void}
323
+ */
324
+ addId: function addId(id) {
325
+ if (this.hasId(id)) {
326
+ return;
327
+ }
328
+
329
+ if (!this.config.id) {
330
+ this.config.id = id;
331
+ } else if (typeof this.config.id === 'string') {
332
+ this.config.id = [this.config.id, id];
333
+ } else if (this.config.id instanceof Array) {
334
+ this.config.id.push(id);
335
+ }
336
+ },
337
+
338
+ /**
339
+ * Removes an existing id. Throws an error
340
+ * if the id is not present
341
+ *
342
+ * @public
343
+ * @param {String} id
344
+ *
345
+ * @returns {void}
346
+ */
347
+ removeId: function removeId(id) {
348
+ if (!this.hasId(id)) {
349
+ throw new Error('Id not found');
350
+ }
351
+
352
+ if (typeof this.config.id === 'string') {
353
+ delete this.config.id;
354
+ } else if (this.config.id instanceof Array) {
355
+ var index = utils.indexOf(id, this.config.id);
356
+ this.config.id.splice(index, 1);
357
+ }
358
+ },
359
+
360
+ /****************************************
361
+ * SELECTOR
362
+ ****************************************/
363
+ getItemsByFilter: function getItemsByFilter(filter) {
364
+ var result = [],
365
+ next = function next(contentItem) {
366
+ for (var i = 0; i < contentItem.contentItems.length; i++) {
367
+ if (filter(contentItem.contentItems[i]) === true) {
368
+ result.push(contentItem.contentItems[i]);
369
+ }
370
+
371
+ next(contentItem.contentItems[i]);
372
+ }
373
+ };
374
+
375
+ next(this);
376
+ return result;
377
+ },
378
+ getItemsById: function getItemsById(id) {
379
+ return this.getItemsByFilter(function (item) {
380
+ if (item.config.id instanceof Array) {
381
+ return utils.indexOf(id, item.config.id) !== -1;
382
+ } else {
383
+ return item.config.id === id;
384
+ }
385
+ });
386
+ },
387
+ getItemsByType: function getItemsByType(type) {
388
+ return this._$getItemsByProperty('type', type);
389
+ },
390
+ getComponentsByName: function getComponentsByName(componentName) {
391
+ var components = this._$getItemsByProperty('componentName', componentName),
392
+ instances = [],
393
+ i;
394
+
395
+ for (i = 0; i < components.length; i++) {
396
+ instances.push(components[i].instance);
397
+ }
398
+
399
+ return instances;
400
+ },
401
+
402
+ /****************************************
403
+ * PACKAGE PRIVATE
404
+ ****************************************/
405
+ _$getItemsByProperty: function _$getItemsByProperty(key, value) {
406
+ return this.getItemsByFilter(function (item) {
407
+ return item[key] === value;
408
+ });
409
+ },
410
+ _$setParent: function _$setParent(parent) {
411
+ this.parent = parent;
412
+ },
413
+ _$highlightDropZone: function _$highlightDropZone(x, y, area) {
414
+ this.layoutManager.dropTargetIndicator.highlightArea(area);
415
+ },
416
+ _$onDrop: function _$onDrop(contentItem) {
417
+ this.addChild(contentItem);
418
+ },
419
+ _$hide: function _$hide() {
420
+ this._callOnActiveComponents('hide');
421
+
422
+ this.element.hide();
423
+ this.layoutManager.updateSize();
424
+ },
425
+ _$show: function _$show() {
426
+ this._callOnActiveComponents('show');
427
+
428
+ this.element.show();
429
+ this.layoutManager.updateSize();
430
+ },
431
+ _callOnActiveComponents: function _callOnActiveComponents(methodName) {
432
+ var stacks = this.getItemsByType('stack'),
433
+ activeContentItem,
434
+ i;
435
+
436
+ for (i = 0; i < stacks.length; i++) {
437
+ activeContentItem = stacks[i].getActiveContentItem();
438
+
439
+ if (activeContentItem && activeContentItem.isComponent) {
440
+ activeContentItem.container[methodName]();
441
+ }
442
+ }
443
+ },
444
+
445
+ /**
446
+ * Destroys this item ands its children
447
+ *
448
+ * @returns {void}
449
+ */
450
+ _$destroy: function _$destroy() {
451
+ this.emitBubblingEvent('beforeItemDestroyed');
452
+ this.callDownwards('_$destroy', [], true, true);
453
+ this.element.remove();
454
+ this.emitBubblingEvent('itemDestroyed');
455
+ },
456
+
457
+ /**
458
+ * Returns the area the component currently occupies in the format
459
+ *
460
+ * {
461
+ * x1: int
462
+ * xy: int
463
+ * y1: int
464
+ * y2: int
465
+ * contentItem: contentItem
466
+ * }
467
+ */
468
+ _$getArea: function _$getArea(element) {
469
+ element = element || this.element;
470
+ var offset = element.offset(),
471
+ width = element.width(),
472
+ height = element.height();
473
+ return {
474
+ x1: offset.left,
475
+ y1: offset.top,
476
+ x2: offset.left + width,
477
+ y2: offset.top + height,
478
+ surface: width * height,
479
+ contentItem: this
480
+ };
481
+ },
482
+
483
+ /**
484
+ * The tree of content items is created in two steps: First all content items are instantiated,
485
+ * then init is called recursively from top to bottem. This is the basic init function,
486
+ * it can be used, extended or overwritten by the content items
487
+ *
488
+ * Its behaviour depends on the content item
489
+ *
490
+ * @package private
491
+ *
492
+ * @returns {void}
493
+ */
494
+ _$init: function _$init() {
495
+ var i;
496
+ this.setSize();
497
+
498
+ for (i = 0; i < this.contentItems.length; i++) {
499
+ this.childElementContainer.append(this.contentItems[i].element);
500
+ }
501
+
502
+ this.isInitialised = true;
503
+ this.emitBubblingEvent('itemCreated');
504
+ this.emitBubblingEvent(this.type + 'Created');
505
+ },
506
+
507
+ /**
508
+ * Emit an event that bubbles up the item tree.
509
+ *
510
+ * @param {String} name The name of the event
511
+ *
512
+ * @returns {void}
513
+ */
514
+ emitBubblingEvent: function emitBubblingEvent(name) {
515
+ var event = new utils.BubblingEvent(name, this);
516
+ this.emit(name, event);
517
+ },
518
+
519
+ /**
520
+ * Private method, creates all content items for this node at initialisation time
521
+ * PLEASE NOTE, please see addChild for adding contentItems add runtime
522
+ * @private
523
+ * @param {configuration item node} config
524
+ *
525
+ * @returns {void}
526
+ */
527
+ _createContentItems: function _createContentItems(config) {
528
+ var oContentItem, i;
529
+
530
+ if (!(config.content instanceof Array)) {
531
+ throw new errors.ConfigurationError('content must be an Array', config);
532
+ }
533
+
534
+ for (i = 0; i < config.content.length; i++) {
535
+ oContentItem = this.layoutManager.createContentItem(config.content[i], this);
536
+ this.contentItems.push(oContentItem);
537
+ }
538
+ },
539
+
540
+ /**
541
+ * Extends an item configuration node with default settings
542
+ * @private
543
+ * @param {configuration item node} config
544
+ *
545
+ * @returns {configuration item node} extended config
546
+ */
547
+ _extendItemNode: function _extendItemNode(config) {
548
+ for (var key in itemDefaultConfig) {
549
+ if (config[key] === undefined) {
550
+ config[key] = itemDefaultConfig[key];
551
+ }
552
+ }
553
+
554
+ return config;
555
+ },
556
+
557
+ /**
558
+ * Called for every event on the item tree. Decides whether the event is a bubbling
559
+ * event and propagates it to its parent
560
+ *
561
+ * @param {String} name the name of the event
562
+ * @param {lm.utils.BubblingEvent} event
563
+ *
564
+ * @returns {void}
565
+ */
566
+ _propagateEvent: function _propagateEvent(name, event) {
567
+ if (event instanceof utils.BubblingEvent && event.isPropagationStopped === false && this.isInitialised === true) {
568
+ /**
569
+ * In some cases (e.g. if an element is created from a DragSource) it
570
+ * doesn't have a parent and is not below root. If that's the case
571
+ * propagate the bubbling event from the top level of the substree directly
572
+ * to the layoutManager
573
+ */
574
+ if (this.isRoot === false && this.parent) {
575
+ this.parent.emit.apply(this.parent, Array.prototype.slice.call(arguments, 0));
576
+ } else {
577
+ this._scheduleEventPropagationToLayoutManager(name, event);
578
+ }
579
+ }
580
+ },
581
+
582
+ /**
583
+ * All raw events bubble up to the root element. Some events that
584
+ * are propagated to - and emitted by - the layoutManager however are
585
+ * only string-based, batched and sanitized to make them more usable
586
+ *
587
+ * @param {String} name the name of the event
588
+ *
589
+ * @private
590
+ * @returns {void}
591
+ */
592
+ _scheduleEventPropagationToLayoutManager: function _scheduleEventPropagationToLayoutManager(name, event) {
593
+ if (utils.indexOf(name, this._throttledEvents) === -1) {
594
+ this.layoutManager.emit(name, event.origin);
595
+ } else {
596
+ if (this._pendingEventPropagations[name] !== true) {
597
+ this._pendingEventPropagations[name] = true;
598
+ utils.animFrame(utils.fnBind(this._propagateEventToLayoutManager, this, [name, event]));
599
+ }
600
+ }
601
+ },
602
+
603
+ /**
604
+ * Callback for events scheduled by _scheduleEventPropagationToLayoutManager
605
+ *
606
+ * @param {String} name the name of the event
607
+ *
608
+ * @private
609
+ * @returns {void}
610
+ */
611
+ _propagateEventToLayoutManager: function _propagateEventToLayoutManager(name, event) {
612
+ this._pendingEventPropagations[name] = false;
613
+ this.layoutManager.emit(name, event);
614
+ }
615
+ });
616
+ export default AbstractContentItem;
617
+ //# sourceMappingURL=AbstractContentItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractContentItem.js","names":["utils","errors","config","itemDefaultConfig","AbstractContentItem","layoutManager","parent","EventEmitter","call","_extendItemNode","type","contentItems","isInitialised","isMaximised","isRoot","isRow","isColumn","isStack","isComponent","_pendingEventPropagations","_throttledEvents","on","ALL_EVENT","_propagateEvent","content","_createContentItems","copy","prototype","setSize","Error","callDownwards","functionName","functionArguments","bottomUp","skipSelf","i","apply","length","removeChild","contentItem","keepChild","index","indexOf","_$destroy","splice","isClosable","addChild","undefined","_$init","replaceChild","oldChild","newChild","_$destroyOldChild","_$normalizeContentItem","parentNode","element","header","tabs","remove","popout","browserPopout","createPopout","emitBubblingEvent","toggleMaximise","e","preventDefault","_$minimiseItem","_$maximiseItem","select","selectedItem","selectItem","addClass","deselect","removeClass","setTitle","title","emit","hasId","id","Array","addId","push","removeId","getItemsByFilter","filter","result","next","getItemsById","item","getItemsByType","_$getItemsByProperty","getComponentsByName","componentName","components","instances","instance","key","value","_$setParent","_$highlightDropZone","x","y","area","dropTargetIndicator","highlightArea","_$onDrop","_$hide","_callOnActiveComponents","hide","updateSize","_$show","show","methodName","stacks","activeContentItem","getActiveContentItem","container","_$getArea","offset","width","height","x1","left","y1","top","x2","y2","surface","childElementContainer","append","name","event","BubblingEvent","oContentItem","ConfigurationError","createContentItem","isPropagationStopped","slice","arguments","_scheduleEventPropagationToLayoutManager","origin","animFrame","fnBind","_propagateEventToLayoutManager"],"sources":["../../src/items/AbstractContentItem.js"],"sourcesContent":["import utils from '../utils/index.js';\nimport errors from '../errors/index.js';\nimport config from '../config/index.js';\n\nconst { itemDefaultConfig } = config;\n\n/**\n * This is the baseclass that all content items inherit from.\n * Most methods provide a subset of what the sub-classes do.\n *\n * It also provides a number of functions for tree traversal\n *\n * @param {lm.LayoutManager} layoutManager\n * @param {item node configuration} config\n * @param {lm.item} parent\n *\n * @event stateChanged\n * @event beforeItemDestroyed\n * @event itemDestroyed\n * @event itemCreated\n * @event componentCreated\n * @event rowCreated\n * @event columnCreated\n * @event stackCreated\n *\n * @constructor\n */\nconst AbstractContentItem = function (layoutManager, config, parent) {\n utils.EventEmitter.call(this);\n\n this.config = this._extendItemNode(config);\n this.type = config.type;\n this.contentItems = [];\n this.parent = parent;\n\n this.isInitialised = false;\n this.isMaximised = false;\n this.isRoot = false;\n this.isRow = false;\n this.isColumn = false;\n this.isStack = false;\n this.isComponent = false;\n\n this.layoutManager = layoutManager;\n this._pendingEventPropagations = {};\n this._throttledEvents = ['stateChanged'];\n\n this.on(utils.EventEmitter.ALL_EVENT, this._propagateEvent, this);\n\n if (config.content) {\n this._createContentItems(config);\n }\n};\n\nutils.copy(AbstractContentItem.prototype, {\n /**\n * Set the size of the component and its children, called recursively\n *\n * @abstract\n * @returns void\n */\n setSize: function () {\n throw new Error('Abstract Method');\n },\n\n /**\n * Calls a method recursively downwards on the tree\n *\n * @param {String} functionName the name of the function to be called\n * @param {[Array]}functionArguments optional arguments that are passed to every function\n * @param {[bool]} bottomUp Call methods from bottom to top, defaults to false\n * @param {[bool]} skipSelf Don't invoke the method on the class that calls it, defaults to false\n *\n * @returns {void}\n */\n callDownwards: function (\n functionName,\n functionArguments,\n bottomUp,\n skipSelf\n ) {\n var i;\n\n if (bottomUp !== true && skipSelf !== true) {\n this[functionName].apply(this, functionArguments || []);\n }\n for (i = 0; i < this.contentItems.length; i++) {\n this.contentItems[i].callDownwards(\n functionName,\n functionArguments,\n bottomUp\n );\n }\n if (bottomUp === true && skipSelf !== true) {\n this[functionName].apply(this, functionArguments || []);\n }\n },\n\n /**\n * Removes a child node (and its children) from the tree\n *\n * @param {lm.items.ContentItem} contentItem\n *\n * @returns {void}\n */\n removeChild: function (contentItem, keepChild) {\n /*\n * Get the position of the item that's to be removed within all content items this node contains\n */\n var index = utils.indexOf(contentItem, this.contentItems);\n\n /*\n * Make sure the content item to be removed is actually a child of this item\n */\n if (index === -1) {\n throw new Error(\"Can't remove child item. Unknown content item\");\n }\n\n /**\n * Call ._$destroy on the content item. This also calls ._$destroy on all its children\n */\n if (keepChild !== true) {\n this.contentItems[index]._$destroy();\n }\n\n /**\n * Remove the content item from this nodes array of children\n */\n this.contentItems.splice(index, 1);\n\n /**\n * Remove the item from the configuration\n */\n this.config.content.splice(index, 1);\n\n /**\n * If this node still contains other content items, adjust their size\n */\n if (this.contentItems.length > 0) {\n this.callDownwards('setSize');\n\n /**\n * If this was the last content item, remove this node as well\n */\n } else if (this.type !== 'root' && this.config.isClosable) {\n this.parent.removeChild(this);\n }\n },\n\n /**\n * Sets up the tree structure for the newly added child\n * The responsibility for the actual DOM manipulations lies\n * with the concrete item\n *\n * @param {lm.items.AbstractContentItem} contentItem\n * @param {[Int]} index If omitted item will be appended\n */\n addChild: function (contentItem, index) {\n if (index === undefined) {\n index = this.contentItems.length;\n }\n\n this.contentItems.splice(index, 0, contentItem);\n\n if (this.config.content === undefined) {\n this.config.content = [];\n }\n\n this.config.content.splice(index, 0, contentItem.config);\n contentItem.parent = this;\n\n if (\n contentItem.parent.isInitialised === true &&\n contentItem.isInitialised === false\n ) {\n contentItem._$init();\n }\n },\n\n /**\n * Replaces oldChild with newChild. This used to use jQuery.replaceWith... which for\n * some reason removes all event listeners, so isn't really an option.\n *\n * @param {lm.item.AbstractContentItem} oldChild\n * @param {lm.item.AbstractContentItem} newChild\n *\n * @returns {void}\n */\n replaceChild: function (oldChild, newChild, _$destroyOldChild) {\n newChild = this.layoutManager._$normalizeContentItem(newChild);\n\n var index = utils.indexOf(oldChild, this.contentItems),\n parentNode = oldChild.element[0].parentNode;\n\n if (index === -1) {\n throw new Error(\"Can't replace child. oldChild is not child of this\");\n }\n\n parentNode.replaceChild(newChild.element[0], oldChild.element[0]);\n\n /*\n * Optionally destroy the old content item\n */\n if (_$destroyOldChild === true) {\n oldChild.parent = null;\n oldChild._$destroy();\n }\n\n /*\n * Wire the new contentItem into the tree\n */\n this.contentItems[index] = newChild;\n newChild.parent = this;\n\n /*\n * Update tab reference\n */\n if (this.isStack) {\n this.header.tabs[index].contentItem = newChild;\n }\n\n //TODO This doesn't update the config... refactor to leave item nodes untouched after creation\n if (\n newChild.parent.isInitialised === true &&\n newChild.isInitialised === false\n ) {\n newChild._$init();\n }\n\n this.callDownwards('setSize');\n },\n\n /**\n * Convenience method.\n * Shorthand for this.parent.removeChild( this )\n *\n * @returns {void}\n */\n remove: function () {\n this.parent.removeChild(this);\n },\n\n /**\n * Removes the component from the layout and creates a new\n * browser window with the component and its children inside\n *\n * @returns {lm.controls.BrowserPopout}\n */\n popout: function () {\n var browserPopout = this.layoutManager.createPopout(this);\n this.emitBubblingEvent('stateChanged');\n return browserPopout;\n },\n\n /**\n * Maximises the Item or minimises it if it is already maximised\n *\n * @returns {void}\n */\n toggleMaximise: function (e) {\n e && e.preventDefault();\n if (this.isMaximised === true) {\n this.layoutManager._$minimiseItem(this);\n } else {\n this.layoutManager._$maximiseItem(this);\n }\n\n this.isMaximised = !this.isMaximised;\n this.emitBubblingEvent('stateChanged');\n },\n\n /**\n * Selects the item if it is not already selected\n *\n * @returns {void}\n */\n select: function () {\n if (this.layoutManager.selectedItem !== this) {\n this.layoutManager.selectItem(this, true);\n this.element.addClass('lm_selected');\n }\n },\n\n /**\n * De-selects the item if it is selected\n *\n * @returns {void}\n */\n deselect: function () {\n if (this.layoutManager.selectedItem === this) {\n this.layoutManager.selectedItem = null;\n this.element.removeClass('lm_selected');\n }\n },\n\n /**\n * Set this component's title\n *\n * @public\n * @param {String} title\n *\n * @returns {void}\n */\n setTitle: function (title) {\n this.config.title = title;\n this.emit('titleChanged', title);\n this.emitBubblingEvent('stateChanged');\n },\n\n /**\n * Checks whether a provided id is present\n *\n * @public\n * @param {String} id\n *\n * @returns {Boolean} isPresent\n */\n hasId: function (id) {\n if (!this.config.id) {\n return false;\n } else if (typeof this.config.id === 'string') {\n return this.config.id === id;\n } else if (this.config.id instanceof Array) {\n return utils.indexOf(id, this.config.id) !== -1;\n }\n },\n\n /**\n * Adds an id. Adds it as a string if the component doesn't\n * have an id yet or creates/uses an array\n *\n * @public\n * @param {String} id\n *\n * @returns {void}\n */\n addId: function (id) {\n if (this.hasId(id)) {\n return;\n }\n\n if (!this.config.id) {\n this.config.id = id;\n } else if (typeof this.config.id === 'string') {\n this.config.id = [this.config.id, id];\n } else if (this.config.id instanceof Array) {\n this.config.id.push(id);\n }\n },\n\n /**\n * Removes an existing id. Throws an error\n * if the id is not present\n *\n * @public\n * @param {String} id\n *\n * @returns {void}\n */\n removeId: function (id) {\n if (!this.hasId(id)) {\n throw new Error('Id not found');\n }\n\n if (typeof this.config.id === 'string') {\n delete this.config.id;\n } else if (this.config.id instanceof Array) {\n var index = utils.indexOf(id, this.config.id);\n this.config.id.splice(index, 1);\n }\n },\n\n /****************************************\n * SELECTOR\n ****************************************/\n getItemsByFilter: function (filter) {\n var result = [],\n next = function (contentItem) {\n for (var i = 0; i < contentItem.contentItems.length; i++) {\n if (filter(contentItem.contentItems[i]) === true) {\n result.push(contentItem.contentItems[i]);\n }\n\n next(contentItem.contentItems[i]);\n }\n };\n\n next(this);\n return result;\n },\n\n getItemsById: function (id) {\n return this.getItemsByFilter(function (item) {\n if (item.config.id instanceof Array) {\n return utils.indexOf(id, item.config.id) !== -1;\n } else {\n return item.config.id === id;\n }\n });\n },\n\n getItemsByType: function (type) {\n return this._$getItemsByProperty('type', type);\n },\n\n getComponentsByName: function (componentName) {\n var components = this._$getItemsByProperty('componentName', componentName),\n instances = [],\n i;\n\n for (i = 0; i < components.length; i++) {\n instances.push(components[i].instance);\n }\n\n return instances;\n },\n\n /****************************************\n * PACKAGE PRIVATE\n ****************************************/\n _$getItemsByProperty: function (key, value) {\n return this.getItemsByFilter(function (item) {\n return item[key] === value;\n });\n },\n\n _$setParent: function (parent) {\n this.parent = parent;\n },\n\n _$highlightDropZone: function (x, y, area) {\n this.layoutManager.dropTargetIndicator.highlightArea(area);\n },\n\n _$onDrop: function (contentItem) {\n this.addChild(contentItem);\n },\n\n _$hide: function () {\n this._callOnActiveComponents('hide');\n this.element.hide();\n this.layoutManager.updateSize();\n },\n\n _$show: function () {\n this._callOnActiveComponents('show');\n this.element.show();\n this.layoutManager.updateSize();\n },\n\n _callOnActiveComponents: function (methodName) {\n var stacks = this.getItemsByType('stack'),\n activeContentItem,\n i;\n\n for (i = 0; i < stacks.length; i++) {\n activeContentItem = stacks[i].getActiveContentItem();\n\n if (activeContentItem && activeContentItem.isComponent) {\n activeContentItem.container[methodName]();\n }\n }\n },\n\n /**\n * Destroys this item ands its children\n *\n * @returns {void}\n */\n _$destroy: function () {\n this.emitBubblingEvent('beforeItemDestroyed');\n this.callDownwards('_$destroy', [], true, true);\n this.element.remove();\n this.emitBubblingEvent('itemDestroyed');\n },\n\n /**\n * Returns the area the component currently occupies in the format\n *\n * {\n *\t\tx1: int\n *\t\txy: int\n *\t\ty1: int\n *\t\ty2: int\n *\t\tcontentItem: contentItem\n * }\n */\n _$getArea: function (element) {\n element = element || this.element;\n\n var offset = element.offset(),\n width = element.width(),\n height = element.height();\n\n return {\n x1: offset.left,\n y1: offset.top,\n x2: offset.left + width,\n y2: offset.top + height,\n surface: width * height,\n contentItem: this,\n };\n },\n\n /**\n * The tree of content items is created in two steps: First all content items are instantiated,\n * then init is called recursively from top to bottem. This is the basic init function,\n * it can be used, extended or overwritten by the content items\n *\n * Its behaviour depends on the content item\n *\n * @package private\n *\n * @returns {void}\n */\n _$init: function () {\n var i;\n this.setSize();\n\n for (i = 0; i < this.contentItems.length; i++) {\n this.childElementContainer.append(this.contentItems[i].element);\n }\n\n this.isInitialised = true;\n this.emitBubblingEvent('itemCreated');\n this.emitBubblingEvent(this.type + 'Created');\n },\n\n /**\n * Emit an event that bubbles up the item tree.\n *\n * @param {String} name The name of the event\n *\n * @returns {void}\n */\n emitBubblingEvent: function (name) {\n var event = new utils.BubblingEvent(name, this);\n this.emit(name, event);\n },\n\n /**\n * Private method, creates all content items for this node at initialisation time\n * PLEASE NOTE, please see addChild for adding contentItems add runtime\n * @private\n * @param {configuration item node} config\n *\n * @returns {void}\n */\n _createContentItems: function (config) {\n var oContentItem, i;\n\n if (!(config.content instanceof Array)) {\n throw new errors.ConfigurationError('content must be an Array', config);\n }\n\n for (i = 0; i < config.content.length; i++) {\n oContentItem = this.layoutManager.createContentItem(\n config.content[i],\n this\n );\n this.contentItems.push(oContentItem);\n }\n },\n\n /**\n * Extends an item configuration node with default settings\n * @private\n * @param {configuration item node} config\n *\n * @returns {configuration item node} extended config\n */\n _extendItemNode: function (config) {\n for (var key in itemDefaultConfig) {\n if (config[key] === undefined) {\n config[key] = itemDefaultConfig[key];\n }\n }\n\n return config;\n },\n\n /**\n * Called for every event on the item tree. Decides whether the event is a bubbling\n * event and propagates it to its parent\n *\n * @param {String} name the name of the event\n * @param {lm.utils.BubblingEvent} event\n *\n * @returns {void}\n */\n _propagateEvent: function (name, event) {\n if (\n event instanceof utils.BubblingEvent &&\n event.isPropagationStopped === false &&\n this.isInitialised === true\n ) {\n /**\n * In some cases (e.g. if an element is created from a DragSource) it\n * doesn't have a parent and is not below root. If that's the case\n * propagate the bubbling event from the top level of the substree directly\n * to the layoutManager\n */\n if (this.isRoot === false && this.parent) {\n this.parent.emit.apply(\n this.parent,\n Array.prototype.slice.call(arguments, 0)\n );\n } else {\n this._scheduleEventPropagationToLayoutManager(name, event);\n }\n }\n },\n\n /**\n * All raw events bubble up to the root element. Some events that\n * are propagated to - and emitted by - the layoutManager however are\n * only string-based, batched and sanitized to make them more usable\n *\n * @param {String} name the name of the event\n *\n * @private\n * @returns {void}\n */\n _scheduleEventPropagationToLayoutManager: function (name, event) {\n if (utils.indexOf(name, this._throttledEvents) === -1) {\n this.layoutManager.emit(name, event.origin);\n } else {\n if (this._pendingEventPropagations[name] !== true) {\n this._pendingEventPropagations[name] = true;\n utils.animFrame(\n utils.fnBind(this._propagateEventToLayoutManager, this, [name, event])\n );\n }\n }\n },\n\n /**\n * Callback for events scheduled by _scheduleEventPropagationToLayoutManager\n *\n * @param {String} name the name of the event\n *\n * @private\n * @returns {void}\n */\n _propagateEventToLayoutManager: function (name, event) {\n this._pendingEventPropagations[name] = false;\n this.layoutManager.emit(name, event);\n },\n});\n\nexport default AbstractContentItem;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,mBAAlB;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AACA,OAAOC,MAAP,MAAmB,oBAAnB;AAEA,IAAM;EAAEC;AAAF,IAAwBD,MAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAAUC,aAAV,EAAyBH,MAAzB,EAAiCI,MAAjC,EAAyC;EACnEN,KAAK,CAACO,YAAN,CAAmBC,IAAnB,CAAwB,IAAxB;EAEA,KAAKN,MAAL,GAAc,KAAKO,eAAL,CAAqBP,MAArB,CAAd;EACA,KAAKQ,IAAL,GAAYR,MAAM,CAACQ,IAAnB;EACA,KAAKC,YAAL,GAAoB,EAApB;EACA,KAAKL,MAAL,GAAcA,MAAd;EAEA,KAAKM,aAAL,GAAqB,KAArB;EACA,KAAKC,WAAL,GAAmB,KAAnB;EACA,KAAKC,MAAL,GAAc,KAAd;EACA,KAAKC,KAAL,GAAa,KAAb;EACA,KAAKC,QAAL,GAAgB,KAAhB;EACA,KAAKC,OAAL,GAAe,KAAf;EACA,KAAKC,WAAL,GAAmB,KAAnB;EAEA,KAAKb,aAAL,GA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