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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/LayoutManager.d.ts +313 -0
  2. package/dist/LayoutManager.d.ts.map +1 -0
  3. package/dist/LayoutManager.js +468 -450
  4. package/dist/LayoutManager.js.map +1 -1
  5. package/dist/base.d.ts +16 -0
  6. package/dist/base.d.ts.map +1 -0
  7. package/dist/base.js +6 -6
  8. package/dist/base.js.map +1 -1
  9. package/dist/config/Config.d.ts +146 -0
  10. package/dist/config/Config.d.ts.map +1 -0
  11. package/dist/config/{defaultConfig.js → Config.js} +6 -6
  12. package/dist/config/Config.js.map +1 -0
  13. package/dist/config/ItemConfig.d.ts +66 -0
  14. package/dist/config/ItemConfig.d.ts.map +1 -0
  15. package/dist/config/ItemConfig.js +14 -0
  16. package/dist/config/ItemConfig.js.map +1 -0
  17. package/dist/config/index.d.ts +3 -0
  18. package/dist/config/index.d.ts.map +1 -0
  19. package/dist/config/index.js +2 -6
  20. package/dist/config/index.js.map +1 -1
  21. package/dist/container/ItemContainer.d.ts +91 -0
  22. package/dist/container/ItemContainer.d.ts.map +1 -0
  23. package/dist/container/ItemContainer.js +110 -85
  24. package/dist/container/ItemContainer.js.map +1 -1
  25. package/dist/container/index.d.ts +3 -0
  26. package/dist/container/index.d.ts.map +1 -0
  27. package/dist/container/index.js +2 -4
  28. package/dist/container/index.js.map +1 -1
  29. package/dist/controls/BrowserPopout.d.ts +83 -0
  30. package/dist/controls/BrowserPopout.d.ts.map +1 -0
  31. package/dist/controls/BrowserPopout.js +135 -101
  32. package/dist/controls/BrowserPopout.js.map +1 -1
  33. package/dist/controls/DragProxy.d.ts +67 -0
  34. package/dist/controls/DragProxy.d.ts.map +1 -0
  35. package/dist/controls/DragProxy.js +135 -110
  36. package/dist/controls/DragProxy.js.map +1 -1
  37. package/dist/controls/DragSource.d.ts +30 -0
  38. package/dist/controls/DragSource.d.ts.map +1 -0
  39. package/dist/controls/DragSource.js +37 -29
  40. package/dist/controls/DragSource.js.map +1 -1
  41. package/dist/controls/DragSourceFromEvent.d.ts +30 -0
  42. package/dist/controls/DragSourceFromEvent.d.ts.map +1 -0
  43. package/dist/controls/DragSourceFromEvent.js +49 -36
  44. package/dist/controls/DragSourceFromEvent.js.map +1 -1
  45. package/dist/controls/DropTargetIndicator.d.ts +14 -0
  46. package/dist/controls/DropTargetIndicator.d.ts.map +1 -0
  47. package/dist/controls/DropTargetIndicator.js +18 -14
  48. package/dist/controls/DropTargetIndicator.js.map +1 -1
  49. package/dist/controls/Header.d.ts +145 -0
  50. package/dist/controls/Header.d.ts.map +1 -0
  51. package/dist/controls/Header.js +414 -271
  52. package/dist/controls/Header.js.map +1 -1
  53. package/dist/controls/HeaderButton.d.ts +9 -0
  54. package/dist/controls/HeaderButton.d.ts.map +1 -0
  55. package/dist/controls/HeaderButton.js +19 -13
  56. package/dist/controls/HeaderButton.js.map +1 -1
  57. package/dist/controls/Splitter.d.ts +12 -0
  58. package/dist/controls/Splitter.d.ts.map +1 -0
  59. package/dist/controls/Splitter.js +36 -20
  60. package/dist/controls/Splitter.js.map +1 -1
  61. package/dist/controls/Tab.d.ts +91 -0
  62. package/dist/controls/Tab.d.ts.map +1 -0
  63. package/dist/controls/Tab.js +131 -119
  64. package/dist/controls/Tab.js.map +1 -1
  65. package/dist/controls/TransitionIndicator.d.ts +25 -0
  66. package/dist/controls/TransitionIndicator.d.ts.map +1 -0
  67. package/dist/controls/TransitionIndicator.js +53 -39
  68. package/dist/controls/TransitionIndicator.js.map +1 -1
  69. package/dist/controls/index.d.ts +11 -0
  70. package/dist/controls/index.d.ts.map +1 -0
  71. package/dist/controls/index.js +10 -22
  72. package/dist/controls/index.js.map +1 -1
  73. package/dist/errors/ConfigurationError.d.ts +6 -0
  74. package/dist/errors/ConfigurationError.d.ts.map +1 -0
  75. package/dist/errors/ConfigurationError.js +15 -8
  76. package/dist/errors/ConfigurationError.js.map +1 -1
  77. package/dist/errors/index.d.ts +2 -0
  78. package/dist/errors/index.d.ts.map +1 -0
  79. package/dist/errors/index.js +1 -4
  80. package/dist/errors/index.js.map +1 -1
  81. package/dist/index.d.ts +9 -0
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/index.js +7 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/items/AbstractContentItem.d.ts +233 -0
  86. package/dist/items/AbstractContentItem.d.ts.map +1 -0
  87. package/dist/items/AbstractContentItem.js +284 -242
  88. package/dist/items/AbstractContentItem.js.map +1 -1
  89. package/dist/items/Component.d.ts +30 -0
  90. package/dist/items/Component.d.ts.map +1 -0
  91. package/dist/items/Component.js +61 -42
  92. package/dist/items/Component.js.map +1 -1
  93. package/dist/items/Root.d.ts +18 -0
  94. package/dist/items/Root.d.ts.map +1 -0
  95. package/dist/items/Root.js +68 -38
  96. package/dist/items/Root.js.map +1 -1
  97. package/dist/items/RowOrColumn.d.ts +157 -0
  98. package/dist/items/RowOrColumn.d.ts.map +1 -0
  99. package/dist/items/RowOrColumn.js +219 -187
  100. package/dist/items/RowOrColumn.js.map +1 -1
  101. package/dist/items/Stack.d.ts +108 -0
  102. package/dist/items/Stack.d.ts.map +1 -0
  103. package/dist/items/Stack.js +218 -151
  104. package/dist/items/Stack.js.map +1 -1
  105. package/dist/items/index.d.ts +8 -0
  106. package/dist/items/index.d.ts.map +1 -0
  107. package/dist/items/index.js +7 -12
  108. package/dist/items/index.js.map +1 -1
  109. package/dist/utils/BubblingEvent.d.ts +8 -0
  110. package/dist/utils/BubblingEvent.d.ts.map +1 -0
  111. package/dist/utils/BubblingEvent.js +18 -9
  112. package/dist/utils/BubblingEvent.js.map +1 -1
  113. package/dist/utils/ConfigMinifier.d.ts +21 -0
  114. package/dist/utils/ConfigMinifier.d.ts.map +1 -0
  115. package/dist/utils/ConfigMinifier.js +121 -121
  116. package/dist/utils/ConfigMinifier.js.map +1 -1
  117. package/dist/utils/DragListener.d.ts +34 -0
  118. package/dist/utils/DragListener.d.ts.map +1 -0
  119. package/dist/utils/DragListener.js +103 -70
  120. package/dist/utils/DragListener.js.map +1 -1
  121. package/dist/utils/EventEmitter.d.ts +59 -0
  122. package/dist/utils/EventEmitter.d.ts.map +1 -0
  123. package/dist/utils/EventEmitter.js +64 -70
  124. package/dist/utils/EventEmitter.js.map +1 -1
  125. package/dist/utils/EventHub.d.ts +55 -0
  126. package/dist/utils/EventHub.d.ts.map +1 -0
  127. package/dist/utils/EventHub.js +83 -105
  128. package/dist/utils/EventHub.js.map +1 -1
  129. package/dist/utils/ReactComponentHandler.d.ts +54 -0
  130. package/dist/utils/ReactComponentHandler.d.ts.map +1 -0
  131. package/dist/utils/ReactComponentHandler.js +58 -56
  132. package/dist/utils/ReactComponentHandler.js.map +1 -1
  133. package/dist/utils/index.d.ts +8 -0
  134. package/dist/utils/index.d.ts.map +1 -0
  135. package/dist/utils/index.js +7 -21
  136. package/dist/utils/index.js.map +1 -1
  137. package/dist/utils/utils.d.ts +25 -0
  138. package/dist/utils/utils.d.ts.map +1 -0
  139. package/dist/utils/utils.js +21 -145
  140. package/dist/utils/utils.js.map +1 -1
  141. package/package.json +9 -5
  142. package/dist/config/ItemDefaultConfig.js +0 -8
  143. package/dist/config/ItemDefaultConfig.js.map +0 -1
  144. package/dist/config/defaultConfig.js.map +0 -1
@@ -1,128 +1,159 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  import $ from 'jquery';
2
- import utils from '../utils/index.js';
4
+ import { stripTags, EventEmitter } from "../utils/index.js";
3
5
  /**
4
6
  * This class creates a temporary container
5
7
  * for the component whilst it is being dragged
6
8
  * and handles drag events
7
9
  *
8
- * @constructor
9
- * @private
10
- *
11
- * @param {Number} x The initial x position
12
- * @param {Number} y The initial y position
13
- * @param {lm.utils.DragListener} dragListener
14
- * @param {lm.LayoutManager} layoutManager
15
- * @param {lm.item.AbstractContentItem} contentItem
16
- * @param {lm.item.AbstractContentItem} originalParent
10
+ * @param x The initial x position
11
+ * @param y The initial y position
12
+ * @param dragListener
13
+ * @param layoutManager
14
+ * @param contentItem
15
+ * @param originalParent
17
16
  */
18
17
 
19
- var DragProxy = function DragProxy(x, y, dragListener, layoutManager, contentItem, originalParent) {
20
- utils.EventEmitter.call(this);
21
- this._dragListener = dragListener;
22
- this._layoutManager = layoutManager;
23
- this._contentItem = contentItem;
24
- this._originalParent = originalParent;
25
- this._area = null;
26
- this._lastValidArea = null;
18
+ export default class DragProxy extends EventEmitter {
19
+ constructor(x, y, dragListener, layoutManager, contentItem, originalParent) {
20
+ var _this$_contentItem$co, _this$_contentItem$co2, _offset$left, _offset$top, _this$_layoutManager$, _this$_layoutManager$2, _this$element$width, _this$element$height;
27
21
 
28
- this._dragListener.on('drag', this._onDrag, this);
22
+ super();
29
23
 
30
- this._dragListener.on('dragStop', this._onDrop, this); // set the inserted drag placeholder to be the size of the tab removed, before its removed
24
+ _defineProperty(this, "_dragListener", void 0);
31
25
 
26
+ _defineProperty(this, "_layoutManager", void 0);
32
27
 
33
- if (this._contentItem.tab && this._contentItem.tab.element) {
34
- this._layoutManager.tabDropPlaceholder.width(this._contentItem.tab.element.outerWidth(true));
28
+ _defineProperty(this, "_contentItem", void 0);
35
29
 
36
- this._layoutManager.tabDropPlaceholder.height(this._contentItem.tab.element.outerHeight(true));
37
- }
30
+ _defineProperty(this, "_originalParent", void 0);
38
31
 
39
- this.element = $(DragProxy._template);
32
+ _defineProperty(this, "_area", null);
40
33
 
41
- if (originalParent && originalParent._side) {
42
- this._sided = originalParent._sided;
43
- this.element.addClass('lm_' + originalParent._side);
44
- if (['right', 'bottom'].indexOf(originalParent._side) >= 0) this.element.find('.lm_content').after(this.element.find('.lm_header'));
45
- }
34
+ _defineProperty(this, "_lastValidArea", null);
46
35
 
47
- this.element.css({
48
- left: x,
49
- top: y
50
- });
51
- this._proxyTab = this.element.find('.lm_tab');
36
+ _defineProperty(this, "_minX", void 0);
52
37
 
53
- this._proxyTab.attr('title', utils.stripTags(this._contentItem.config.title));
38
+ _defineProperty(this, "_maxX", void 0);
54
39
 
55
- this.element.find('.lm_title').html(this._contentItem.config.title);
56
- this.childElementContainer = this.element.find('.lm_content');
57
- this.childElementContainer.append(contentItem.element);
40
+ _defineProperty(this, "_minY", void 0);
58
41
 
59
- this._updateTree();
42
+ _defineProperty(this, "_maxY", void 0);
60
43
 
61
- this._layoutManager._$calculateItemAreas();
44
+ _defineProperty(this, "_width", void 0);
62
45
 
63
- this._setDimensions();
46
+ _defineProperty(this, "_height", void 0);
64
47
 
65
- $(document.body).append(this.element); // there's no content tab to use yet, use the proxy tab size for placeholder sizing, after it's created
48
+ _defineProperty(this, "_sided", void 0);
66
49
 
67
- if (!this._contentItem.tab && this._proxyTab.length) {
68
- this._layoutManager.tabDropPlaceholder.width(this._proxyTab.outerWidth(true));
50
+ _defineProperty(this, "element", void 0);
69
51
 
70
- this._layoutManager.tabDropPlaceholder.height(this._proxyTab.outerHeight(true));
71
- }
52
+ _defineProperty(this, "childElementContainer", void 0);
72
53
 
73
- var offset = this._layoutManager.container.offset();
54
+ _defineProperty(this, "_proxyTab", void 0);
74
55
 
75
- this._minX = offset.left;
76
- this._minY = offset.top;
77
- this._maxX = this._layoutManager.container.width() + this._minX;
78
- this._maxY = this._layoutManager.container.height() + this._minY;
79
- this._width = this.element.width();
80
- this._height = this.element.height();
56
+ this._dragListener = dragListener;
57
+ this._layoutManager = layoutManager;
58
+ this._contentItem = contentItem;
59
+ this._originalParent = originalParent;
81
60
 
82
- this._setDropPosition(x, y);
61
+ this._dragListener.on('drag', this._onDrag, this);
83
62
 
84
- this._layoutManager.emit('itemPickedUp', this._contentItem);
85
- };
63
+ this._dragListener.on('dragStop', this._onDrop, this); // set the inserted drag placeholder to be the size of the tab removed, before its removed
86
64
 
87
- DragProxy._template = '<div class="lm_dragProxy">' + '<div class="lm_header">' + '<ul class="lm_tabs">' + '<li class="lm_tab lm_active"><i class="lm_left"></i>' + '<span class="lm_title"></span>' + '<i class="lm_right"></i></li>' + '</ul>' + '</div>' + '<div class="lm_content"></div>' + '</div>';
88
- utils.copy(DragProxy.prototype, {
65
+
66
+ if (this._contentItem.tab && this._contentItem.tab.element) {
67
+ var _this$_contentItem$ta, _this$_contentItem$ta2;
68
+
69
+ this._layoutManager.tabDropPlaceholder.width((_this$_contentItem$ta = this._contentItem.tab.element.outerWidth(true)) !== null && _this$_contentItem$ta !== void 0 ? _this$_contentItem$ta : 0);
70
+
71
+ this._layoutManager.tabDropPlaceholder.height((_this$_contentItem$ta2 = this._contentItem.tab.element.outerHeight(true)) !== null && _this$_contentItem$ta2 !== void 0 ? _this$_contentItem$ta2 : 0);
72
+ }
73
+
74
+ this.element = $(DragProxy._template);
75
+
76
+ if (originalParent && originalParent._side) {
77
+ this._sided = originalParent._sided;
78
+ this.element.addClass('lm_' + originalParent._side);
79
+ if (['right', 'bottom'].indexOf(originalParent._side.toString()) >= 0) this.element.find('.lm_content').after(this.element.find('.lm_header'));
80
+ }
81
+
82
+ this.element.css({
83
+ left: x,
84
+ top: y
85
+ });
86
+ this._proxyTab = this.element.find('.lm_tab');
87
+
88
+ this._proxyTab.attr('title', stripTags((_this$_contentItem$co = this._contentItem.config.title) !== null && _this$_contentItem$co !== void 0 ? _this$_contentItem$co : ''));
89
+
90
+ this.element.find('.lm_title').html((_this$_contentItem$co2 = this._contentItem.config.title) !== null && _this$_contentItem$co2 !== void 0 ? _this$_contentItem$co2 : '');
91
+ this.childElementContainer = this.element.find('.lm_content');
92
+ this.childElementContainer.append(contentItem.element);
93
+
94
+ this._updateTree();
95
+
96
+ this._layoutManager._$calculateItemAreas();
97
+
98
+ this._setDimensions();
99
+
100
+ $(document.body).append(this.element); // there's no content tab to use yet, use the proxy tab size for placeholder sizing, after it's created
101
+
102
+ if (!this._contentItem.tab && this._proxyTab.length) {
103
+ var _this$_proxyTab$outer, _this$_proxyTab$outer2;
104
+
105
+ this._layoutManager.tabDropPlaceholder.width((_this$_proxyTab$outer = this._proxyTab.outerWidth(true)) !== null && _this$_proxyTab$outer !== void 0 ? _this$_proxyTab$outer : 0);
106
+
107
+ this._layoutManager.tabDropPlaceholder.height((_this$_proxyTab$outer2 = this._proxyTab.outerHeight(true)) !== null && _this$_proxyTab$outer2 !== void 0 ? _this$_proxyTab$outer2 : 0);
108
+ }
109
+
110
+ var offset = this._layoutManager.container.offset();
111
+
112
+ this._minX = (_offset$left = offset === null || offset === void 0 ? void 0 : offset.left) !== null && _offset$left !== void 0 ? _offset$left : 0;
113
+ this._minY = (_offset$top = offset === null || offset === void 0 ? void 0 : offset.top) !== null && _offset$top !== void 0 ? _offset$top : 0;
114
+ this._maxX = ((_this$_layoutManager$ = this._layoutManager.container.width()) !== null && _this$_layoutManager$ !== void 0 ? _this$_layoutManager$ : 0) + this._minX;
115
+ this._maxY = ((_this$_layoutManager$2 = this._layoutManager.container.height()) !== null && _this$_layoutManager$2 !== void 0 ? _this$_layoutManager$2 : 0) + this._minY;
116
+ this._width = (_this$element$width = this.element.width()) !== null && _this$element$width !== void 0 ? _this$element$width : 0;
117
+ this._height = (_this$element$height = this.element.height()) !== null && _this$element$height !== void 0 ? _this$element$height : 0;
118
+
119
+ this._setDropPosition(x, y);
120
+
121
+ this._layoutManager.emit('itemPickedUp', this._contentItem);
122
+ }
89
123
  /**
90
124
  * Callback on every mouseMove event during a drag. Determines if the drag is
91
125
  * still within the valid drag area and calls the layoutManager to highlight the
92
126
  * current drop area
93
127
  *
94
- * @param {Number} offsetX The difference from the original x position in px
95
- * @param {Number} offsetY The difference from the original y position in px
96
- * @param {jQuery DOM event} event
97
- *
98
- * @private
99
- *
100
- * @returns {void}
128
+ * @param offsetX The difference from the original x position in px
129
+ * @param offsetY The difference from the original y position in px
130
+ * @param event
101
131
  */
102
- _onDrag: function _onDrag(offsetX, offsetY, event) {
103
- event = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[0] : event;
104
- var x = event.pageX,
105
- y = event.pageY,
106
- isWithinContainer = x > this._minX && x < this._maxX && y > this._minY && y < this._maxY;
132
+
133
+
134
+ _onDrag(offsetX, offsetY, event) {
135
+ var _baseEvent$pageX, _baseEvent$pageY;
136
+
137
+ var baseEvent = event.originalEvent instanceof TouchEvent ? event.originalEvent.touches[0] : event;
138
+ var x = (_baseEvent$pageX = baseEvent.pageX) !== null && _baseEvent$pageX !== void 0 ? _baseEvent$pageX : 0;
139
+ var y = (_baseEvent$pageY = baseEvent.pageY) !== null && _baseEvent$pageY !== void 0 ? _baseEvent$pageY : 0;
140
+ var isWithinContainer = x > this._minX && x < this._maxX && y > this._minY && y < this._maxY;
107
141
 
108
142
  if (!isWithinContainer && this._layoutManager.config.settings.constrainDragToContainer === true) {
109
143
  return;
110
144
  }
111
145
 
112
146
  this._setDropPosition(x, y);
113
- },
114
-
147
+ }
115
148
  /**
116
149
  * Sets the target position, highlighting the appropriate area
117
150
  *
118
- * @param {Number} x The x position in px
119
- * @param {Number} y The y position in px
120
- *
121
- * @private
122
- *
123
- * @returns {void}
151
+ * @param x The x position in px
152
+ * @param y The y position in px
124
153
  */
125
- _setDropPosition: function _setDropPosition(x, y) {
154
+
155
+
156
+ _setDropPosition(x, y) {
126
157
  this.element.css({
127
158
  left: x,
128
159
  top: y
@@ -134,23 +165,21 @@ utils.copy(DragProxy.prototype, {
134
165
 
135
166
  this._area.contentItem._$highlightDropZone(x, y, this._area);
136
167
  }
137
- },
138
-
168
+ }
139
169
  /**
140
170
  * Callback when the drag has finished. Determines the drop area
141
171
  * and adds the child to it
142
- *
143
- * @private
144
- *
145
- * @returns {void}
146
172
  */
147
- _onDrop: function _onDrop() {
148
- this._layoutManager.dropTargetIndicator.hide();
173
+
174
+
175
+ _onDrop() {
176
+ var _this$_layoutManager$3;
177
+
178
+ (_this$_layoutManager$3 = this._layoutManager.dropTargetIndicator) === null || _this$_layoutManager$3 === void 0 ? void 0 : _this$_layoutManager$3.hide();
149
179
  /*
150
180
  * Valid drop area found
151
181
  */
152
182
 
153
-
154
183
  if (this._area !== null) {
155
184
  this._area.contentItem._$onDrop(this._contentItem, this._area);
156
185
  /**
@@ -185,16 +214,13 @@ utils.copy(DragProxy.prototype, {
185
214
  this.element.remove();
186
215
 
187
216
  this._layoutManager.emit('itemDropped', this._contentItem);
188
- },
189
-
217
+ }
190
218
  /**
191
219
  * Removes the item from its original position within the tree
192
- *
193
- * @private
194
- *
195
- * @returns {void}
196
220
  */
197
- _updateTree: function _updateTree() {
221
+
222
+
223
+ _updateTree() {
198
224
  /**
199
225
  * parent is null if the drag had been initiated by a external drag source
200
226
  */
@@ -202,20 +228,17 @@ utils.copy(DragProxy.prototype, {
202
228
  this._contentItem.parent.removeChild(this._contentItem, true);
203
229
  }
204
230
 
205
- this._contentItem._$setParent(this);
206
- },
207
-
231
+ this._contentItem._$setParent(null);
232
+ }
208
233
  /**
209
- * Updates the Drag Proxie's dimensions
210
- *
211
- * @private
212
- *
213
- * @returns {void}
234
+ * Updates the DragProxy's dimensions
214
235
  */
215
- _setDimensions: function _setDimensions() {
216
- var dimensions = this._layoutManager.config.dimensions,
217
- width = dimensions.dragProxyWidth,
218
- height = dimensions.dragProxyHeight;
236
+
237
+
238
+ _setDimensions() {
239
+ var dimensions = this._layoutManager.config.dimensions;
240
+ var width = dimensions.dragProxyWidth;
241
+ var height = dimensions.dragProxyHeight;
219
242
  this.element.width(width);
220
243
  this.element.height(height);
221
244
  width -= this._sided ? dimensions.headerHeight : 0;
@@ -231,6 +254,8 @@ utils.copy(DragProxy.prototype, {
231
254
 
232
255
  this._contentItem.callDownwards('setSize');
233
256
  }
234
- });
235
- export default DragProxy;
257
+
258
+ }
259
+
260
+ _defineProperty(DragProxy, "_template", '<div class="lm_dragProxy">' + '<div class="lm_header">' + '<ul class="lm_tabs">' + '<li class="lm_tab lm_active"><i class="lm_left"></i>' + '<span class="lm_title"></span>' + '<i class="lm_right"></i></li>' + '</ul>' + '</div>' + '<div class="lm_content"></div>' + '</div>');
236
261
  //# sourceMappingURL=DragProxy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragProxy.js","names":["$","utils","DragProxy","x","y","dragListener","layoutManager","contentItem","originalParent","EventEmitter","call","_dragListener","_layoutManager","_contentItem","_originalParent","_area","_lastValidArea","on","_onDrag","_onDrop","tab","element","tabDropPlaceholder","width","outerWidth","height","outerHeight","_template","_side","_sided","addClass","indexOf","find","after","css","left","top","_proxyTab","attr","stripTags","config","title","html","childElementContainer","append","_updateTree","_$calculateItemAreas","_setDimensions","document","body","length","offset","container","_minX","_minY","_maxX","_maxY","_width","_height","_setDropPosition","emit","copy","prototype","offsetX","offsetY","event","originalEvent","touches","pageX","pageY","isWithinContainer","settings","constrainDragToContainer","_$getArea","_$highlightDropZone","dropTargetIndicator","hide","_$onDrop","addChild","_$destroy","off","remove","parent","removeChild","_$setParent","dimensions","dragProxyWidth","dragProxyHeight","headerHeight","callDownwards"],"sources":["../../src/controls/DragProxy.js"],"sourcesContent":["import $ from 'jquery';\nimport utils from '../utils/index.js';\n\n/**\n * This class creates a temporary container\n * for the component whilst it is being dragged\n * and handles drag events\n *\n * @constructor\n * @private\n *\n * @param {Number} x The initial x position\n * @param {Number} y The initial y position\n * @param {lm.utils.DragListener} dragListener\n * @param {lm.LayoutManager} layoutManager\n * @param {lm.item.AbstractContentItem} contentItem\n * @param {lm.item.AbstractContentItem} originalParent\n */\nconst DragProxy = function (\n x,\n y,\n dragListener,\n layoutManager,\n contentItem,\n originalParent\n) {\n utils.EventEmitter.call(this);\n\n this._dragListener = dragListener;\n this._layoutManager = layoutManager;\n this._contentItem = contentItem;\n this._originalParent = originalParent;\n\n this._area = null;\n this._lastValidArea = null;\n\n this._dragListener.on('drag', this._onDrag, this);\n this._dragListener.on('dragStop', this._onDrop, this);\n\n // set the inserted drag placeholder to be the size of the tab removed, before its removed\n if (this._contentItem.tab && this._contentItem.tab.element) {\n this._layoutManager.tabDropPlaceholder.width(\n this._contentItem.tab.element.outerWidth(true)\n );\n this._layoutManager.tabDropPlaceholder.height(\n this._contentItem.tab.element.outerHeight(true)\n );\n }\n\n this.element = $(DragProxy._template);\n if (originalParent && originalParent._side) {\n this._sided = originalParent._sided;\n this.element.addClass('lm_' + originalParent._side);\n if (['right', 'bottom'].indexOf(originalParent._side) >= 0)\n this.element.find('.lm_content').after(this.element.find('.lm_header'));\n }\n this.element.css({ left: x, top: y });\n this._proxyTab = this.element.find('.lm_tab');\n this._proxyTab.attr('title', utils.stripTags(this._contentItem.config.title));\n this.element.find('.lm_title').html(this._contentItem.config.title);\n this.childElementContainer = this.element.find('.lm_content');\n this.childElementContainer.append(contentItem.element);\n\n this._updateTree();\n this._layoutManager._$calculateItemAreas();\n this._setDimensions();\n\n $(document.body).append(this.element);\n\n // there's no content tab to use yet, use the proxy tab size for placeholder sizing, after it's created\n if (!this._contentItem.tab && this._proxyTab.length) {\n this._layoutManager.tabDropPlaceholder.width(\n this._proxyTab.outerWidth(true)\n );\n this._layoutManager.tabDropPlaceholder.height(\n this._proxyTab.outerHeight(true)\n );\n }\n\n var offset = this._layoutManager.container.offset();\n\n this._minX = offset.left;\n this._minY = offset.top;\n this._maxX = this._layoutManager.container.width() + this._minX;\n this._maxY = this._layoutManager.container.height() + this._minY;\n this._width = this.element.width();\n this._height = this.element.height();\n\n this._setDropPosition(x, y);\n\n this._layoutManager.emit('itemPickedUp', this._contentItem);\n};\n\nDragProxy._template =\n '<div class=\"lm_dragProxy\">' +\n '<div class=\"lm_header\">' +\n '<ul class=\"lm_tabs\">' +\n '<li class=\"lm_tab lm_active\"><i class=\"lm_left\"></i>' +\n '<span class=\"lm_title\"></span>' +\n '<i class=\"lm_right\"></i></li>' +\n '</ul>' +\n '</div>' +\n '<div class=\"lm_content\"></div>' +\n '</div>';\n\nutils.copy(DragProxy.prototype, {\n /**\n * Callback on every mouseMove event during a drag. Determines if the drag is\n * still within the valid drag area and calls the layoutManager to highlight the\n * current drop area\n *\n * @param {Number} offsetX The difference from the original x position in px\n * @param {Number} offsetY The difference from the original y position in px\n * @param {jQuery DOM event} event\n *\n * @private\n *\n * @returns {void}\n */\n _onDrag: function (offsetX, offsetY, event) {\n event =\n event.originalEvent && event.originalEvent.touches\n ? event.originalEvent.touches[0]\n : event;\n\n var x = event.pageX,\n y = event.pageY,\n isWithinContainer =\n x > this._minX && x < this._maxX && y > this._minY && y < this._maxY;\n\n if (\n !isWithinContainer &&\n this._layoutManager.config.settings.constrainDragToContainer === true\n ) {\n return;\n }\n\n this._setDropPosition(x, y);\n },\n\n /**\n * Sets the target position, highlighting the appropriate area\n *\n * @param {Number} x The x position in px\n * @param {Number} y The y position in px\n *\n * @private\n *\n * @returns {void}\n */\n _setDropPosition: function (x, y) {\n this.element.css({ left: x, top: y });\n this._area = this._layoutManager._$getArea(x, y);\n\n if (this._area !== null) {\n this._lastValidArea = this._area;\n this._area.contentItem._$highlightDropZone(x, y, this._area);\n }\n },\n\n /**\n * Callback when the drag has finished. Determines the drop area\n * and adds the child to it\n *\n * @private\n *\n * @returns {void}\n */\n _onDrop: function () {\n this._layoutManager.dropTargetIndicator.hide();\n\n /*\n * Valid drop area found\n */\n if (this._area !== null) {\n this._area.contentItem._$onDrop(this._contentItem, this._area);\n\n /**\n * No valid drop area available at present, but one has been found before.\n * Use it\n */\n } else if (this._lastValidArea !== null) {\n this._lastValidArea.contentItem._$onDrop(\n this._contentItem,\n this._lastValidArea\n );\n\n /**\n * No valid drop area found during the duration of the drag. Return\n * content item to its original position if a original parent is provided.\n * (Which is not the case if the drag had been initiated by createDragSource)\n */\n } else if (this._originalParent) {\n this._originalParent.addChild(this._contentItem);\n\n /**\n * The drag didn't ultimately end up with adding the content item to\n * any container. In order to ensure clean up happens, destroy the\n * content item.\n */\n } else {\n this._contentItem._$destroy();\n }\n\n this._dragListener.off('drag', this._onDrag, this);\n this._dragListener.off('dragStop', this._onDrop, this);\n\n this.element.remove();\n\n this._layoutManager.emit('itemDropped', this._contentItem);\n },\n\n /**\n * Removes the item from its original position within the tree\n *\n * @private\n *\n * @returns {void}\n */\n _updateTree: function () {\n /**\n * parent is null if the drag had been initiated by a external drag source\n */\n if (this._contentItem.parent) {\n this._contentItem.parent.removeChild(this._contentItem, true);\n }\n\n this._contentItem._$setParent(this);\n },\n\n /**\n * Updates the Drag Proxie's dimensions\n *\n * @private\n *\n * @returns {void}\n */\n _setDimensions: function () {\n var dimensions = this._layoutManager.config.dimensions,\n width = dimensions.dragProxyWidth,\n height = dimensions.dragProxyHeight;\n\n this.element.width(width);\n this.element.height(height);\n width -= this._sided ? dimensions.headerHeight : 0;\n height -= !this._sided ? dimensions.headerHeight : 0;\n this.childElementContainer.width(width);\n this.childElementContainer.height(height);\n this._contentItem.element.width(width);\n this._contentItem.element.height(height);\n this._contentItem.callDownwards('_$show');\n this._contentItem.callDownwards('setSize');\n },\n});\n\nexport default DragProxy;\n"],"mappings":"AAAA,OAAOA,CAAP,MAAc,QAAd;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAChBC,CADgB,EAEhBC,CAFgB,EAGhBC,YAHgB,EAIhBC,aAJgB,EAKhBC,WALgB,EAMhBC,cANgB,EAOhB;EACAP,KAAK,CAACQ,YAAN,CAAmBC,IAAnB,CAAwB,IAAxB;EAEA,KAAKC,aAAL,GAAqBN,YAArB;EACA,KAAKO,cAAL,GAAsBN,aAAtB;EACA,KAAKO,YAAL,GAAoBN,WAApB;EACA,KAAKO,eAAL,GAAuBN,cAAvB;EAEA,KAAKO,KAAL,GAAa,IAAb;EACA,KAAKC,cAAL,GAAsB,IAAtB;;EAEA,KAAKL,aAAL,CAAmBM,EAAnB,CAAsB,MAAtB,EAA8B,KAAKC,OAAnC,EAA4C,IAA5C;;EACA,KAAKP,aAAL,CAAmBM,EAAnB,CAAsB,UAAtB,EAAkC,KAAKE,OAA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DragProxy","constructor","x","y","dragListener","layoutManager","contentItem","originalParent","_dragListener","_layoutManager","_contentItem","_originalParent","on","_onDrag","_onDrop","tab","element","tabDropPlaceholder","width","outerWidth","height","outerHeight","_template","_side","_sided","addClass","indexOf","toString","find","after","css","left","top","_proxyTab","attr","config","title","html","childElementContainer","append","_updateTree","_$calculateItemAreas","_setDimensions","document","body","length","offset","container","_minX","_minY","_maxX","_maxY","_width","_height","_setDropPosition","emit","offsetX","offsetY","event","baseEvent","originalEvent","TouchEvent","touches","pageX","pageY","isWithinContainer","settings","constrainDragToContainer","_area","_$getArea","_lastValidArea","_$highlightDropZone","dropTargetIndicator","hide","_$onDrop","addChild","_$destroy","off","remove","parent","removeChild","_$setParent","dimensions","dragProxyWidth","dragProxyHeight","headerHeight","callDownwards"],"sources":["../../src/controls/DragProxy.ts"],"sourcesContent":["import $ from 'jquery';\nimport type { AbstractContentItem, ItemArea, Stack } from '../items';\nimport type LayoutManager from '../LayoutManager';\nimport type { DragListener } from '../utils';\nimport { stripTags, EventEmitter } from '../utils';\n\n/**\n * This class creates a temporary container\n * for the component whilst it is being dragged\n * and handles drag events\n *\n * @param x The initial x position\n * @param y The initial y position\n * @param dragListener\n * @param layoutManager\n * @param contentItem\n * @param originalParent\n */\nexport default class DragProxy extends EventEmitter {\n private static _template =\n '<div class=\"lm_dragProxy\">' +\n '<div class=\"lm_header\">' +\n '<ul class=\"lm_tabs\">' +\n '<li class=\"lm_tab lm_active\"><i class=\"lm_left\"></i>' +\n '<span class=\"lm_title\"></span>' +\n '<i class=\"lm_right\"></i></li>' +\n '</ul>' +\n '</div>' +\n '<div class=\"lm_content\"></div>' +\n '</div>';\n\n private _dragListener: DragListener;\n private _layoutManager: LayoutManager;\n private _contentItem: AbstractContentItem;\n private _originalParent: Stack | null;\n\n private _area: ItemArea | null = null;\n private _lastValidArea: ItemArea | null = null;\n\n private _minX: number;\n private _maxX: number;\n private _minY: number;\n private _maxY: number;\n private _width: number;\n private _height: number;\n private _sided?: boolean;\n\n element: JQuery<HTMLElement>;\n childElementContainer: JQuery<HTMLElement>;\n private _proxyTab: JQuery<HTMLElement>;\n\n constructor(\n x: number,\n y: number,\n dragListener: DragListener,\n layoutManager: LayoutManager,\n contentItem: AbstractContentItem,\n originalParent: Stack | null\n ) {\n super();\n\n this._dragListener = dragListener;\n this._layoutManager = layoutManager;\n this._contentItem = contentItem;\n this._originalParent = originalParent;\n\n this._dragListener.on('drag', this._onDrag, this);\n this._dragListener.on('dragStop', this._onDrop, this);\n\n // set the inserted drag placeholder to be the size of the tab removed, before its removed\n if (this._contentItem.tab && this._contentItem.tab.element) {\n this._layoutManager.tabDropPlaceholder.width(\n this._contentItem.tab.element.outerWidth(true) ?? 0\n );\n this._layoutManager.tabDropPlaceholder.height(\n this._contentItem.tab.element.outerHeight(true) ?? 0\n );\n }\n\n this.element = $(DragProxy._template);\n if (originalParent && originalParent._side) {\n this._sided = originalParent._sided;\n this.element.addClass('lm_' + originalParent._side);\n if (['right', 'bottom'].indexOf(originalParent._side.toString()) >= 0)\n this.element.find('.lm_content').after(this.element.find('.lm_header'));\n }\n this.element.css({ left: x, top: y });\n this._proxyTab = this.element.find('.lm_tab');\n this._proxyTab.attr(\n 'title',\n stripTags(this._contentItem.config.title ?? '')\n );\n this.element.find('.lm_title').html(this._contentItem.config.title ?? '');\n this.childElementContainer = this.element.find('.lm_content');\n this.childElementContainer.append(contentItem.element);\n\n this._updateTree();\n this._layoutManager._$calculateItemAreas();\n this._setDimensions();\n\n $(document.body).append(this.element);\n\n // there's no content tab to use yet, use the proxy tab size for placeholder sizing, after it's created\n if (!this._contentItem.tab && this._proxyTab.length) {\n this._layoutManager.tabDropPlaceholder.width(\n this._proxyTab.outerWidth(true) ?? 0\n );\n this._layoutManager.tabDropPlaceholder.height(\n this._proxyTab.outerHeight(true) ?? 0\n );\n }\n\n var offset = this._layoutManager.container.offset();\n\n this._minX = offset?.left ?? 0;\n this._minY = offset?.top ?? 0;\n this._maxX = (this._layoutManager.container.width() ?? 0) + this._minX;\n this._maxY = (this._layoutManager.container.height() ?? 0) + this._minY;\n this._width = this.element.width() ?? 0;\n this._height = this.element.height() ?? 0;\n\n this._setDropPosition(x, y);\n\n this._layoutManager.emit('itemPickedUp', this._contentItem);\n }\n\n /**\n * Callback on every mouseMove event during a drag. Determines if the drag is\n * still within the valid drag area and calls the layoutManager to highlight the\n * current drop area\n *\n * @param offsetX The difference from the original x position in px\n * @param offsetY The difference from the original y position in px\n * @param event\n */\n _onDrag(offsetX: number, offsetY: number, event: JQuery.TriggeredEvent) {\n const baseEvent =\n event.originalEvent instanceof TouchEvent\n ? event.originalEvent.touches[0]\n : event;\n\n const x = baseEvent.pageX ?? 0;\n const y = baseEvent.pageY ?? 0;\n const isWithinContainer =\n x > this._minX && x < this._maxX && y > this._minY && y < this._maxY;\n\n if (\n !isWithinContainer &&\n this._layoutManager.config.settings.constrainDragToContainer === true\n ) {\n return;\n }\n\n this._setDropPosition(x, y);\n }\n\n /**\n * Sets the target position, highlighting the appropriate area\n *\n * @param x The x position in px\n * @param y The y position in px\n */\n _setDropPosition(x: number, y: number) {\n this.element.css({ left: x, top: y });\n this._area = this._layoutManager._$getArea(x, y);\n\n if (this._area !== null) {\n this._lastValidArea = this._area;\n this._area.contentItem._$highlightDropZone(x, y, this._area);\n }\n }\n\n /**\n * Callback when the drag has finished. Determines the drop area\n * and adds the child to it\n */\n _onDrop() {\n this._layoutManager.dropTargetIndicator?.hide();\n\n /*\n * Valid drop area found\n */\n if (this._area !== null) {\n this._area.contentItem._$onDrop(this._contentItem, this._area);\n\n /**\n * No valid drop area available at present, but one has been found before.\n * Use it\n */\n } else if (this._lastValidArea !== null) {\n this._lastValidArea.contentItem._$onDrop(\n this._contentItem,\n this._lastValidArea\n );\n\n /**\n * No valid drop area found during the duration of the drag. Return\n * content item to its original position if a original parent is provided.\n * (Which is not the case if the drag had been initiated by createDragSource)\n */\n } else if (this._originalParent) {\n this._originalParent.addChild(this._contentItem);\n\n /**\n * The drag didn't ultimately end up with adding the content item to\n * any container. In order to ensure clean up happens, destroy the\n * content item.\n */\n } else {\n this._contentItem._$destroy();\n }\n\n this._dragListener.off('drag', this._onDrag, this);\n this._dragListener.off('dragStop', this._onDrop, this);\n\n this.element.remove();\n\n this._layoutManager.emit('itemDropped', this._contentItem);\n }\n\n /**\n * Removes the item from its original position within the tree\n */\n _updateTree() {\n /**\n * parent is null if the drag had been initiated by a external drag source\n */\n if (this._contentItem.parent) {\n this._contentItem.parent.removeChild(this._contentItem, true);\n }\n\n this._contentItem._$setParent(null);\n }\n\n /**\n * Updates the DragProxy's dimensions\n */\n _setDimensions() {\n const dimensions = this._layoutManager.config.dimensions;\n let width = dimensions.dragProxyWidth;\n let height = dimensions.dragProxyHeight;\n\n this.element.width(width);\n this.element.height(height);\n width -= this._sided ? dimensions.headerHeight : 0;\n height -= !this._sided ? dimensions.headerHeight : 0;\n this.childElementContainer.width(width);\n this.childElementContainer.height(height);\n this._contentItem.element.width(width);\n this._contentItem.element.height(height);\n this._contentItem.callDownwards('_$show');\n this._contentItem.callDownwards('setSize');\n }\n}\n"],"mappings":";;AAAA,OAAOA,CAAP,MAAc,QAAd;SAISC,S,EAAWC,Y;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,MAAMC,SAAN,SAAwBD,YAAxB,CAAqC;EAiClDE,WAAW,CACTC,CADS,EAETC,CAFS,EAGTC,YAHS,EAITC,aAJS,EAKTC,WALS,EAMTC,cANS,EAOT;IAAA;;IACA;;IADA;;IAAA;;IAAA;;IAAA;;IAAA,+BAtB+B,IAsB/B;;IAAA,wCArBwC,IAqBxC;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAGA,KAAKC,aAAL,GAAqBJ,YAArB;IACA,KAAKK,cAAL,GAAsBJ,aAAtB;IACA,KAAKK,YAAL,GAAoBJ,WAApB;IACA,KAAKK,eAAL,GAAu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;EACD;;AA1OiD;;gBAA/BtF,S,eAEjB,+BACA,yBADA,GAEA,sBAFA,GAGA,sDAHA,GAIA,gCAJA,GAKA,+BALA,GAMA,OANA,GAOA,QAPA,GAQA,gCARA,GASA,Q"}
@@ -0,0 +1,30 @@
1
+ import type { ItemConfigType } from '../config';
2
+ import type LayoutManager from '../LayoutManager';
3
+ import { DragListener } from '../utils';
4
+ /**
5
+ * Allows for any DOM item to create a component on drag
6
+ * start tobe dragged into the Layout
7
+ *
8
+ * @param element
9
+ * @param itemConfig the configuration for the contentItem that will be created
10
+ * @param layoutManager
11
+ */
12
+ export default class DragSource {
13
+ _element: JQuery<HTMLElement>;
14
+ _itemConfig: ItemConfigType | (() => ItemConfigType);
15
+ _layoutManager: LayoutManager;
16
+ _dragListener: DragListener;
17
+ constructor(element: JQuery<HTMLElement>, itemConfig: ItemConfigType | (() => ItemConfigType), layoutManager: LayoutManager);
18
+ /**
19
+ * Called initially and after every drag
20
+ */
21
+ _createDragListener(): DragListener;
22
+ /**
23
+ * Callback for the DragListener's dragStart event
24
+ *
25
+ * @param x the x position of the mouse on dragStart
26
+ * @param y the x position of the mouse on dragStart
27
+ */
28
+ _onDragStart(x: number, y: number): void;
29
+ }
30
+ //# sourceMappingURL=DragSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragSource.d.ts","sourceRoot":"","sources":["../../src/controls/DragSource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9B,WAAW,EAAE,cAAc,GAAG,CAAC,MAAM,cAAc,CAAC,CAAC;IACrD,cAAc,EAAE,aAAa,CAAC;IAC9B,aAAa,EAAE,YAAY,CAAC;gBAG1B,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,EAC5B,UAAU,EAAE,cAAc,GAAG,CAAC,MAAM,cAAc,CAAC,EACnD,aAAa,EAAE,aAAa;IAS9B;;OAEG;IACH,mBAAmB;IAOnB;;;;;OAKG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAsBlC"}
@@ -1,60 +1,68 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
1
3
  import $ from 'jquery';
2
- import utils from '../utils/index.js';
3
- import DragProxy from './DragProxy.js';
4
+ import { DragListener } from "../utils/index.js";
5
+ import DragProxy from "./DragProxy.js";
4
6
  /**
5
7
  * Allows for any DOM item to create a component on drag
6
8
  * start tobe dragged into the Layout
7
9
  *
8
- * @param {jQuery element} element
9
- * @param {Object} itemConfig the configuration for the contentItem that will be created
10
- * @param {LayoutManager} layoutManager
11
- *
12
- * @constructor
10
+ * @param element
11
+ * @param itemConfig the configuration for the contentItem that will be created
12
+ * @param layoutManager
13
13
  */
14
14
 
15
- var DragSource = function DragSource(element, itemConfig, layoutManager) {
16
- this._element = element;
17
- this._itemConfig = itemConfig;
18
- this._layoutManager = layoutManager;
19
- this._dragListener = null;
15
+ export default class DragSource {
16
+ constructor(element, itemConfig, layoutManager) {
17
+ _defineProperty(this, "_element", void 0);
18
+
19
+ _defineProperty(this, "_itemConfig", void 0);
20
+
21
+ _defineProperty(this, "_layoutManager", void 0);
20
22
 
21
- this._createDragListener();
22
- };
23
+ _defineProperty(this, "_dragListener", void 0);
23
24
 
24
- utils.copy(DragSource.prototype, {
25
+ this._element = element;
26
+ this._itemConfig = itemConfig;
27
+ this._layoutManager = layoutManager;
28
+ this._dragListener = this._createDragListener();
29
+ }
25
30
  /**
26
31
  * Called initially and after every drag
27
- *
28
- * @returns {void}
29
32
  */
30
- _createDragListener: function _createDragListener() {
31
- this._dragListener = new utils.DragListener(this._element, true);
33
+
34
+
35
+ _createDragListener() {
36
+ this._dragListener = new DragListener(this._element, true);
32
37
 
33
38
  this._dragListener.on('dragStart', this._onDragStart, this);
34
39
 
35
40
  this._dragListener.on('dragStop', this._createDragListener, this);
36
- },
37
41
 
42
+ return this._dragListener;
43
+ }
38
44
  /**
39
45
  * Callback for the DragListener's dragStart event
40
46
  *
41
- * @param {int} x the x position of the mouse on dragStart
42
- * @param {int} y the x position of the mouse on dragStart
43
- *
44
- * @returns {void}
47
+ * @param x the x position of the mouse on dragStart
48
+ * @param y the x position of the mouse on dragStart
45
49
  */
46
- _onDragStart: function _onDragStart(x, y) {
50
+
51
+
52
+ _onDragStart(x, y) {
53
+ var _this$_layoutManager$;
54
+
47
55
  var itemConfig = this._itemConfig;
48
56
 
49
- if (utils.isFunction(itemConfig)) {
57
+ if (typeof itemConfig === 'function') {
50
58
  itemConfig = itemConfig();
51
59
  }
52
60
 
53
61
  var contentItem = this._layoutManager._$normalizeContentItem($.extend(true, {}, itemConfig)),
54
62
  dragProxy = new DragProxy(x, y, this._dragListener, this._layoutManager, contentItem, null);
55
63
 
56
- this._layoutManager.transitionIndicator.transitionElements(this._element, dragProxy.element);
64
+ (_this$_layoutManager$ = this._layoutManager.transitionIndicator) === null || _this$_layoutManager$ === void 0 ? void 0 : _this$_layoutManager$.transitionElements(this._element, dragProxy.element);
57
65
  }
58
- });
59
- export default DragSource;
66
+
67
+ }
60
68
  //# sourceMappingURL=DragSource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DragSource.js","names":["$","utils","DragProxy","DragSource","element","itemConfig","layoutManager","_element","_itemConfig","_layoutManager","_dragListener","_createDragListener","copy","prototype","DragListener","on","_onDragStart","x","y","isFunction","contentItem","_$normalizeContentItem","extend","dragProxy","transitionIndicator","transitionElements"],"sources":["../../src/controls/DragSource.js"],"sourcesContent":["import $ from 'jquery';\nimport utils from '../utils/index.js';\nimport DragProxy from './DragProxy.js';\n\n/**\n * Allows for any DOM item to create a component on drag\n * start tobe dragged into the Layout\n *\n * @param {jQuery element} element\n * @param {Object} itemConfig the configuration for the contentItem that will be created\n * @param {LayoutManager} layoutManager\n *\n * @constructor\n */\nconst DragSource = function (element, itemConfig, layoutManager) {\n this._element = element;\n this._itemConfig = itemConfig;\n this._layoutManager = layoutManager;\n this._dragListener = null;\n\n this._createDragListener();\n};\n\nutils.copy(DragSource.prototype, {\n /**\n * Called initially and after every drag\n *\n * @returns {void}\n */\n _createDragListener: function () {\n this._dragListener = new utils.DragListener(this._element, true);\n this._dragListener.on('dragStart', this._onDragStart, this);\n this._dragListener.on('dragStop', this._createDragListener, this);\n },\n\n /**\n * Callback for the DragListener's dragStart event\n *\n * @param {int} x the x position of the mouse on dragStart\n * @param {int} y the x position of the mouse on dragStart\n *\n * @returns {void}\n */\n _onDragStart: function (x, y) {\n var itemConfig = this._itemConfig;\n if (utils.isFunction(itemConfig)) {\n itemConfig = itemConfig();\n }\n var contentItem = this._layoutManager._$normalizeContentItem(\n $.extend(true, {}, itemConfig)\n ),\n dragProxy = new DragProxy(\n x,\n y,\n this._dragListener,\n this._layoutManager,\n contentItem,\n null\n );\n\n this._layoutManager.transitionIndicator.transitionElements(\n this._element,\n dragProxy.element\n );\n },\n});\n\nexport default DragSource;\n"],"mappings":"AAAA,OAAOA,CAAP,MAAc,QAAd;AACA,OAAOC,KAAP,MAAkB,mBAAlB;AACA,OAAOC,SAAP,MAAsB,gBAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAAUC,OAAV,EAAmBC,UAAnB,EAA+BC,aAA/B,EAA8C;EAC/D,KAAKC,QAAL,GAAgBH,OAAhB;EACA,KAAKI,WAAL,GAAmBH,UAAnB;EACA,KAAKI,cAAL,GAAsBH,aAAtB;EACA,KAAKI,aAAL,GAAqB,IAArB;;EAEA,KAAKC,mBAAL;AACD,CAPD;;AASAV,KAAK,CAACW,IAAN,CAAWT,UAAU,CAACU,SAAtB,EAAiC;EAC/B;AACF;AACA;AACA;AACA;EACEF,mBAAmB,EAAE,+BAAY;IAC/B,KAAKD,aAAL,GAAqB,IAAIT,KAAK,CAACa,YAAV,CAAuB,KAAKP,QAA5B,EAAsC,IAAtC,CAArB;;IACA,KAAKG,aAAL,CAAmBK,EAAnB,CAAsB,WAAtB,EAAmC,KAAKC,YAAxC,EAAsD,IAAtD;;IACA,KAAKN,aAAL,CAAmBK,EAAnB,CAAsB,UAAtB,EAAkC,KAAKJ,mBAAvC,EAA4D,IAA5D;EACD,CAV8B;;EAY/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,YAAY,EAAE,sBAAUC,CAAV,EAAaC,CAAb,EAAgB;IAC5B,IAAIb,UAAU,GAAG,KAAKG,WAAtB;;IACA,IAAIP,KAAK,CAACkB,UAAN,CAAiBd,UAAjB,CAAJ,EAAkC;MAChCA,UAAU,GAAGA,UAAU,EAAvB;IACD;;IACD,IAAIe,WAAW,GAAG,KAAKX,cAAL,CAAoBY,sBAApB,CACdrB,CAAC,CAACsB,MAAF,CAAS,IAAT,EAAe,EAAf,EAAmBjB,UAAnB,CADc,CAAlB;IAAA,IAGEkB,SAAS,GAAG,IAAIrB,SAAJ,CACVe,CADU,EAEVC,CAFU,EAGV,KAAKR,aAHK,EAIV,KAAKD,cAJK,EAKVW,WALU,EAMV,IANU,CAHd;;IAYA,KAAKX,cAAL,CAAoBe,mBAApB,CAAwCC,kBAAxC,CACE,KAAKlB,QADP,EAEEgB,SAAS,CAACnB,OAFZ;EAID;AAzC8B,CAAjC;AA4CA,eAAeD,UAAf"}
1
+ {"version":3,"file":"DragSource.js","names":["$","DragListener","DragProxy","DragSource","constructor","element","itemConfig","layoutManager","_element","_itemConfig","_layoutManager","_dragListener","_createDragListener","on","_onDragStart","x","y","contentItem","_$normalizeContentItem","extend","dragProxy","transitionIndicator","transitionElements"],"sources":["../../src/controls/DragSource.ts"],"sourcesContent":["import $ from 'jquery';\nimport type { ItemConfigType } from '../config';\nimport type LayoutManager from '../LayoutManager';\nimport { DragListener } from '../utils';\nimport DragProxy from './DragProxy';\n\n/**\n * Allows for any DOM item to create a component on drag\n * start tobe dragged into the Layout\n *\n * @param element\n * @param itemConfig the configuration for the contentItem that will be created\n * @param layoutManager\n */\nexport default class DragSource {\n _element: JQuery<HTMLElement>;\n _itemConfig: ItemConfigType | (() => ItemConfigType);\n _layoutManager: LayoutManager;\n _dragListener: DragListener;\n\n constructor(\n element: JQuery<HTMLElement>,\n itemConfig: ItemConfigType | (() => ItemConfigType),\n layoutManager: LayoutManager\n ) {\n this._element = element;\n this._itemConfig = itemConfig;\n this._layoutManager = layoutManager;\n\n this._dragListener = this._createDragListener();\n }\n\n /**\n * Called initially and after every drag\n */\n _createDragListener() {\n this._dragListener = new DragListener(this._element, true);\n this._dragListener.on('dragStart', this._onDragStart, this);\n this._dragListener.on('dragStop', this._createDragListener, this);\n return this._dragListener;\n }\n\n /**\n * Callback for the DragListener's dragStart event\n *\n * @param x the x position of the mouse on dragStart\n * @param y the x position of the mouse on dragStart\n */\n _onDragStart(x: number, y: number) {\n let itemConfig = this._itemConfig;\n if (typeof itemConfig === 'function') {\n itemConfig = itemConfig();\n }\n const contentItem = this._layoutManager._$normalizeContentItem(\n $.extend(true, {}, itemConfig)\n ),\n dragProxy = new DragProxy(\n x,\n y,\n this._dragListener,\n this._layoutManager,\n contentItem,\n null\n );\n\n this._layoutManager.transitionIndicator?.transitionElements(\n this._element,\n dragProxy.element\n );\n }\n}\n"],"mappings":";;AAAA,OAAOA,CAAP,MAAc,QAAd;SAGSC,Y;OACFC,S;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,MAAMC,UAAN,CAAiB;EAM9BC,WAAW,CACTC,OADS,EAETC,UAFS,EAGTC,aAHS,EAIT;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,QAAL,GAAgBH,OAAhB;IACA,KAAKI,WAAL,GAAmBH,UAAnB;IACA,KAAKI,cAAL,GAAsBH,aAAtB;IAEA,KAAKI,aAAL,GAAqB,KAAKC,mBAAL,EAArB;EACD;EAED;AACF;AACA;;;EACEA,mBAAmB,GAAG;IACpB,KAAKD,aAAL,GAAqB,IAAIV,YAAJ,CAAiB,KAAKO,QAAtB,EAAgC,IAAhC,CAArB;;IACA,KAAKG,aAAL,CAAmBE,EAAnB,CAAsB,WAAtB,EAAmC,KAAKC,YAAxC,EAAsD,IAAtD;;IACA,KAAKH,aAAL,CAAmBE,EAAnB,CAAsB,UAAtB,EAAkC,KAAKD,mBAAvC,EAA4D,IAA5D;;IACA,OAAO,KAAKD,aAAZ;EACD;EAED;AACF;AACA;AACA;AACA;AACA;;;EACEG,YAAY,CAACC,CAAD,EAAYC,CAAZ,EAAuB;IAAA;;IACjC,IAAIV,UAAU,GAAG,KAAKG,WAAtB;;IACA,IAAI,OAAOH,UAAP,KAAsB,UAA1B,EAAsC;MACpCA,UAAU,GAAGA,UAAU,EAAvB;IACD;;IACD,IAAMW,WAAW,GAAG,KAAKP,cAAL,CAAoBQ,sBAApB,CAChBlB,CAAC,CAACmB,MAAF,CAAS,IAAT,EAAe,EAAf,EAAmBb,UAAnB,CADgB,CAApB;IAAA,IAGEc,SAAS,GAAG,IAAIlB,SAAJ,CACVa,CADU,EAEVC,CAFU,EAGV,KAAKL,aAHK,EAIV,KAAKD,cAJK,EAKVO,WALU,EAMV,IANU,CAHd;;IAYA,8BAAKP,cAAL,CAAoBW,mBAApB,gFAAyCC,kBAAzC,CACE,KAAKd,QADP,EAEEY,SAAS,CAACf,OAFZ;EAID;;AAvD6B"}
@@ -0,0 +1,30 @@
1
+ import type { ItemConfig } from '../config';
2
+ import type LayoutManager from '../LayoutManager';
3
+ /**
4
+ * Creates a drag item given a starting mouseevent
5
+ * that can then be dragged into the Layout
6
+ *
7
+ * @param itemConfig the configuration for the contentItem that will be created
8
+ * @param layoutManager
9
+ * @param event used to get the starting position
10
+ */
11
+ export default class DragSourceFromEvent {
12
+ private _element?;
13
+ private _itemConfig?;
14
+ private _layoutManager?;
15
+ private _dragListener?;
16
+ constructor(itemConfig: ItemConfig | (() => ItemConfig), layoutManager: LayoutManager, event: JQuery.TriggeredEvent);
17
+ /**
18
+ * Called initially and after every drag
19
+ */
20
+ _createDragListener(event: JQuery.TriggeredEvent): void;
21
+ _destroy(): void;
22
+ /**
23
+ * Callback for the DragListener's dragStart event
24
+ *
25
+ * @param x the x position of the mouse on dragStart
26
+ * @param y the x position of the mouse on dragStart
27
+ */
28
+ _onDragStart(x: number, y: number): void;
29
+ }
30
+ //# sourceMappingURL=DragSourceFromEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragSourceFromEvent.d.ts","sourceRoot":"","sources":["../../src/controls/DragSourceFromEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAIlD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC,OAAO,CAAC,QAAQ,CAAC,CAAiD;IAClE,OAAO,CAAC,WAAW,CAAC,CAAkC;IACtD,OAAO,CAAC,cAAc,CAAC,CAAgB;IACvC,OAAO,CAAC,aAAa,CAAC,CAAe;gBAGnC,UAAU,EAAE,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,EAC3C,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,MAAM,CAAC,cAAc;IAQ9B;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc;IAkBhD,QAAQ;IAOR;;;;;OAKG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAqBlC"}