@deephaven/golden-layout 0.21.1-beta.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controls/DragProxy.d.ts.map +1 -1
- package/dist/controls/DragProxy.js +3 -4
- package/dist/controls/DragProxy.js.map +1 -1
- package/dist/utils/DragListener.d.ts +2 -2
- package/dist/utils/DragListener.d.ts.map +1 -1
- package/dist/utils/DragListener.js +4 -3
- package/dist/utils/DragListener.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragProxy.d.ts","sourceRoot":"","sources":["../../src/controls/DragProxy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAY,KAAK,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAa,YAAY,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,YAAY;IACjD,OAAO,CAAC,MAAM,CAAC,SAAS,CAUb;IAEX,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,eAAe,CAAe;IAEtC,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,cAAc,CAAyB;IAE/C,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,CAAU;IAEzB,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC7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IAC7B,qBAAqB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO,CAAC,SAAS,CAAsB;gBAGrC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,mBAAmB,EAChC,cAAc,EAAE,KAAK,GAAG,IAAI;IAqE9B;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,cAAc;IAgBtE;;;;;OAKG;IACH,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAUrC;;;OAGG;IACH,OAAO;IA4CP;;OAEG;IACH,WAAW;IAWX;;OAEG;IACH,cAAc;CAgBf"}
|
|
@@ -132,11 +132,10 @@ export default class DragProxy extends EventEmitter {
|
|
|
132
132
|
|
|
133
133
|
|
|
134
134
|
_onDrag(offsetX, offsetY, event) {
|
|
135
|
-
var
|
|
135
|
+
var _event$pageX, _event$pageY;
|
|
136
136
|
|
|
137
|
-
var
|
|
138
|
-
var
|
|
139
|
-
var y = (_baseEvent$pageY = baseEvent.pageY) !== null && _baseEvent$pageY !== void 0 ? _baseEvent$pageY : 0;
|
|
137
|
+
var x = (_event$pageX = event.pageX) !== null && _event$pageX !== void 0 ? _event$pageX : 0;
|
|
138
|
+
var y = (_event$pageY = event.pageY) !== null && _event$pageY !== void 0 ? _event$pageY : 0;
|
|
140
139
|
var isWithinContainer = x > this._minX && x < this._maxX && y > this._minY && y < this._maxY;
|
|
141
140
|
|
|
142
141
|
if (!isWithinContainer && this._layoutManager.config.settings.constrainDragToContainer === true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragProxy.js","names":["$","stripTags","EventEmitter","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,GAAuBJ,cAAvB;;IAEA,KAAKC,aAAL,CAAmBI,EAAnB,CAAsB,MAAtB,EAA8B,KAAKC,OAA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,gCAJA,GAKA,+BALA,GAMA,OANA,GAOA,QAPA,GAQA,gCARA,GASA,Q"}
|
|
1
|
+
{"version":3,"file":"DragProxy.js","names":["$","stripTags","EventEmitter","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","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 x = event.pageX ?? 0;\n const y = event.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;I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OA,QAPA,GAQA,gCARA,GASA,Q"}
|
|
@@ -26,8 +26,8 @@ declare class DragListener extends EventEmitter {
|
|
|
26
26
|
onMouseUp(oEvent: JQuery.TriggeredEvent): void;
|
|
27
27
|
_startDrag(): void;
|
|
28
28
|
_getCoordinates(event: JQuery.TriggeredEvent): {
|
|
29
|
-
x: number
|
|
30
|
-
y: number
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
export default DragListener;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragListener.d.ts","sourceRoot":"","sources":["../../src/utils/DragListener.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAM,YAAa,SAAQ,YAAY;IACrC,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,MAAM,CAAkC;IAEhD,OAAO,CAAC,oBAAoB,CAAU;IAEtC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAO;IAEtB,OAAO,CAAC,QAAQ,CAAqB;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,UAAU,CAAM;IAExB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,GAAG,CAAK;IAEhB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAK;IAExB,OAAO,CAAC,UAAU,CAAS;gBAEf,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,mBAAmB,UAAQ;IAkBtE,OAAO;IAYP,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAgBzC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAwBzC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAuBvC,UAAU;IASV,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"DragListener.d.ts","sourceRoot":"","sources":["../../src/utils/DragListener.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAM,YAAa,SAAQ,YAAY;IACrC,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,MAAM,CAAkC;IAEhD,OAAO,CAAC,oBAAoB,CAAU;IAEtC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAO;IAEtB,OAAO,CAAC,QAAQ,CAAqB;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,UAAU,CAAM;IAExB,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,GAAG,CAAK;IAEhB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAK;IAExB,OAAO,CAAC,UAAU,CAAS;gBAEf,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,mBAAmB,UAAQ;IAkBtE,OAAO;IAYP,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAgBzC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAwBzC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc;IAuBvC,UAAU;IASV,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc;;;;CAM7C;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -148,10 +148,11 @@ class DragListener extends EventEmitter {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
_getCoordinates(event) {
|
|
151
|
-
var
|
|
151
|
+
var _event$pageX, _event$pageY;
|
|
152
|
+
|
|
152
153
|
return {
|
|
153
|
-
x:
|
|
154
|
-
y:
|
|
154
|
+
x: (_event$pageX = event.pageX) !== null && _event$pageX !== void 0 ? _event$pageX : 0,
|
|
155
|
+
y: (_event$pageY = event.pageY) !== null && _event$pageY !== void 0 ? _event$pageY : 0
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
158
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragListener.js","names":["$","EventEmitter","DragListener","constructor","eElement","destroyAfterMouseUp","_eElement","_oDocument","document","_eBody","body","_destroyAfterMouseUp","onMouseMove","bind","onMouseUp","onMouseDown","_startDrag","on","destroy","unbind","undefined","clearTimeout","_timeout","oEvent","preventDefault","button","coordinates","_getCoordinates","_nOriginalX","x","_nOriginalY","y","window","setTimeout","_nDelay","_nX","_nY","_bDragging","Math","abs","_nDistance","emit","find","css","removeClass","Window","addClass","event","
|
|
1
|
+
{"version":3,"file":"DragListener.js","names":["$","EventEmitter","DragListener","constructor","eElement","destroyAfterMouseUp","_eElement","_oDocument","document","_eBody","body","_destroyAfterMouseUp","onMouseMove","bind","onMouseUp","onMouseDown","_startDrag","on","destroy","unbind","undefined","clearTimeout","_timeout","oEvent","preventDefault","button","coordinates","_getCoordinates","_nOriginalX","x","_nOriginalY","y","window","setTimeout","_nDelay","_nX","_nY","_bDragging","Math","abs","_nDistance","emit","find","css","removeClass","Window","addClass","event","pageX","pageY"],"sources":["../../src/utils/DragListener.ts"],"sourcesContent":["import $ from 'jquery';\nimport EventEmitter from './EventEmitter';\n\nclass DragListener extends EventEmitter {\n private _eElement: JQuery<HTMLElement> | undefined;\n private _oDocument: JQuery<Document> | undefined;\n private _eBody: JQuery<HTMLElement> | undefined;\n\n private _destroyAfterMouseUp: boolean;\n\n /**\n * The delay after which to start the drag in milliseconds\n */\n private _nDelay = 400;\n\n private _timeout: number | undefined;\n public timeout: number | undefined;\n\n /**\n * The distance the mouse needs to be moved to qualify as a drag\n */\n private _nDistance = 10; //TODO - works better with delay only\n\n private _nX = 0;\n private _nY = 0;\n\n private _nOriginalX = 0;\n private _nOriginalY = 0;\n\n private _bDragging = false;\n\n constructor(eElement: JQuery<HTMLElement>, destroyAfterMouseUp = false) {\n super();\n\n this._eElement = eElement;\n this._oDocument = $(document);\n this._eBody = $(document.body);\n // used by drag sources, to destroy listener at the right time\n this._destroyAfterMouseUp = destroyAfterMouseUp;\n\n this.onMouseMove = this.onMouseMove.bind(this);\n this.onMouseUp = this.onMouseUp.bind(this);\n this.onMouseDown = this.onMouseDown.bind(this);\n this._startDrag = this._startDrag.bind(this);\n\n // https://github.com/microsoft/TypeScript/issues/48546\n this._eElement?.on('mousedown', this.onMouseDown);\n }\n\n destroy() {\n this._eElement?.unbind('mousedown', this.onMouseDown);\n this._oDocument?.unbind('mouseup', this.onMouseUp);\n\n this._eElement = undefined;\n this._oDocument = undefined;\n this._eBody = undefined;\n\n clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n\n onMouseDown(oEvent: JQuery.TriggeredEvent) {\n oEvent.preventDefault();\n\n if (oEvent.button === 0) {\n var coordinates = this._getCoordinates(oEvent);\n\n this._nOriginalX = coordinates.x ?? 0;\n this._nOriginalY = coordinates.y ?? 0;\n\n this._oDocument?.on('mousemove', this.onMouseMove);\n this._oDocument?.on('mouseup', this.onMouseUp);\n\n this._timeout = window.setTimeout(this._startDrag, this._nDelay);\n }\n }\n\n onMouseMove(oEvent: JQuery.TriggeredEvent) {\n if (this._timeout != null) {\n oEvent.preventDefault();\n\n var coordinates = this._getCoordinates(oEvent);\n\n this._nX = (coordinates.x ?? 0) - this._nOriginalX;\n this._nY = (coordinates.y ?? 0) - this._nOriginalY;\n\n if (this._bDragging === false) {\n if (\n Math.abs(this._nX) > this._nDistance ||\n Math.abs(this._nY) > this._nDistance\n ) {\n this._startDrag();\n }\n }\n\n if (this._bDragging) {\n this.emit('drag', this._nX, this._nY, oEvent);\n }\n }\n }\n\n onMouseUp(oEvent: JQuery.TriggeredEvent) {\n if (this._timeout != null) {\n clearTimeout(this._timeout);\n this._oDocument?.unbind('mousemove', this.onMouseMove);\n this._oDocument?.unbind('mouseup', this.onMouseUp);\n this._oDocument?.find('iframe')?.css('pointer-events', '');\n\n if (this._bDragging === true) {\n this._bDragging = false;\n this.emit('dragStop', oEvent, this._nOriginalX + this._nX);\n }\n\n // after dragStop, so that .lm_dragging is removed after size is processed\n // and any overflow: hidden remains applied during the calculations\n this._eBody?.removeClass('lm_dragging');\n if (!(this._eElement instanceof Window)) {\n this._eElement?.removeClass('lm_dragging');\n }\n\n if (this._destroyAfterMouseUp) this.destroy();\n }\n }\n\n _startDrag() {\n window.clearTimeout(this._timeout);\n this._bDragging = true;\n this._eBody?.addClass('lm_dragging');\n this._eElement?.addClass('lm_dragging');\n this._oDocument?.find('iframe')?.css('pointer-events', 'none');\n this.emit('dragStart', this._nOriginalX, this._nOriginalY);\n }\n\n _getCoordinates(event: JQuery.TriggeredEvent) {\n return {\n x: event.pageX ?? 0,\n y: event.pageY ?? 0,\n };\n }\n}\n\nexport default DragListener;\n"],"mappings":";;AAAA,OAAOA,CAAP,MAAc,QAAd;OACOC,Y;;AAEP,MAAMC,YAAN,SAA2BD,YAA3B,CAAwC;EAOtC;AACF;AACA;;EAME;AACF;AACA;EAC2B;EAUzBE,WAAW,CAACC,QAAD,EAA6D;IAAA;;IAAA,IAA7BC,mBAA6B,uEAAP,KAAO;IACtE;;IADsE;;IAAA;;IAAA;;IAAA;;IAAA,iCAlBtD,GAkBsD;;IAAA;;IAAA;;IAAA,oCAVnD,EAUmD;;IAAA,6BAR1D,CAQ0D;;IAAA,6BAP1D,CAO0D;;IAAA,qCALlD,CAKkD;;IAAA,qCAJlD,CAIkD;;IAAA,oCAFnD,KAEmD;;IAGtE,KAAKC,SAAL,GAAiBF,QAAjB;IACA,KAAKG,UAAL,GAAkBP,CAAC,CAACQ,QAAD,CAAnB;IACA,KAAKC,MAAL,GAAcT,CAAC,CAACQ,QAAQ,CAACE,IAAV,CAAf,CALsE,CAMtE;;IACA,KAAKC,oBAAL,GAA4BN,mBAA5B;IAEA,KAAKO,WAAL,GAAmB,KAAKA,WAAL,CAAiBC,IAAjB,CAAsB,IAAtB,CAAnB;IACA,KAAKC,SAAL,GAAiB,KAAKA,SA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;;;MACA,qBAAK1B,MAAL,8DAAamC,WAAb,CAAyB,aAAzB;;MACA,IAAI,EAAE,KAAKtC,SAAL,YAA0BuC,MAA5B,CAAJ,EAAyC;QAAA;;QACvC,yBAAKvC,SAAL,sEAAgBsC,WAAhB,CAA4B,aAA5B;MACD;;MAED,IAAI,KAAKjC,oBAAT,EAA+B,KAAKO,OAAL;IAChC;EACF;;EAEDF,UAAU,GAAG;IAAA;;IACXgB,MAAM,CAACX,YAAP,CAAoB,KAAKC,QAAzB;IACA,KAAKe,UAAL,GAAkB,IAAlB;IACA,sBAAK5B,MAAL,gEAAaqC,QAAb,CAAsB,aAAtB;IACA,yBAAKxC,SAAL,sEAAgBwC,QAAhB,CAAyB,aAAzB;IACA,0BAAKvC,UAAL,iGAAiBmC,IAAjB,CAAsB,QAAtB,iFAAiCC,GAAjC,CAAqC,gBAArC,EAAuD,MAAvD;IACA,KAAKF,IAAL,CAAU,WAAV,EAAuB,KAAKb,WAA5B,EAAyC,KAAKE,WAA9C;EACD;;EAEDH,eAAe,CAACoB,KAAD,EAA+B;IAAA;;IAC5C,OAAO;MACLlB,CAAC,kBAAEkB,KAAK,CAACC,KAAR,uDAAiB,CADb;MAELjB,CAAC,kBAAEgB,KAAK,CAACE,KAAR,uDAAiB;IAFb,CAAP;EAID;;AAvIqC;;AA0IxC,eAAe/C,YAAf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/golden-layout",
|
|
3
|
-
"version": "0.21.1
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"author": "Deephaven Data Labs LLC",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "A multi-screen javascript Layout manager",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"karma-browserify": "^8.1.0",
|
|
59
59
|
"watchify": "^4.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "ecdbc76bcb69fa51d9d07b0922863482502764a9"
|
|
62
62
|
}
|