{"version":3,"sources":["webpack://GridStack/webpack/universalModuleDefinition","webpack://GridStack/./src/gridstack-dd.ts","webpack://GridStack/./src/gridstack-ddi.ts","webpack://GridStack/./src/gridstack-engine.ts","webpack://GridStack/./src/gridstack.ts","webpack://GridStack/./src/h5/dd-base-impl.ts","webpack://GridStack/./src/h5/dd-draggable.ts","webpack://GridStack/./src/h5/dd-droppable.ts","webpack://GridStack/./src/h5/dd-element.ts","webpack://GridStack/./src/h5/dd-manager.ts","webpack://GridStack/./src/h5/dd-resizable-handle.ts","webpack://GridStack/./src/h5/dd-resizable.ts","webpack://GridStack/./src/h5/dd-utils.ts","webpack://GridStack/./src/h5/gridstack-dd-native.ts","webpack://GridStack/./src/index-h5.ts","webpack://GridStack/./src/utils.ts","webpack://GridStack/webpack/bootstrap","webpack://GridStack/webpack/startup"],"names":["root","factory","exports","module","define","amd","self","GridStackDD","GridStackDDI","get","el","this","draggable","resizable","gridstackNode","_initDD","GridStack","prototype","_setupAcceptWidget","opts","staticGrid","acceptWidgets","droppable","accept","grid","onDrag","event","node","pos","getCellFromPixel","left","pageX","top","pageY","x","Math","max","y","_added","engine","canMoveNode","moveNode","_updateContainerHeight","autoPosition","willItFit","cleanNodes","beginUpdate","addNode","_writePosAttr","placeholder","w","h","appendChild","_beforeDragX","_beforeDragY","canAccept","selector","matches","maxRow","n","minW","minH","on","_readAttr","round","offsetWidth","cellWidth","offsetHeight","getCellHeight","newNode","prepareNode","_temporary","_isOutOfGrid","_gridstackNodeOrig","off","removeNode","parentNode","remove","helper","wasAdded","parentElement","origNode","oGrid","removedNodes","push","_triggerRemoveEvent","_id","cleanupNode","cloneNode","Utils","removePositioningStyles","_writeAttr","addedNodes","_triggerAddEvent","_triggerChangeEvent","endUpdate","_gsEventHandler","type","undefined","window","setTimeout","_prepareDragDropByNode","_setupRemoveDrop","removable","trashEl","document","querySelector","isDroppable","removableOptions","dataset","inTrashZone","_setupRemovingTimeout","_clearRemovingTimeout","_removeTimeout","classList","add","_isAboutToRemove","removeTimeout","clearTimeout","_setupDragIn","dragIn","isDraggable","dragInOptions","cellHeight","locked","noMove","disableDrag","noResize","disableResize","onStartMoving","ui","target","append","_prevYPix","position","maxW","maxH","dragOrResize","resizing","distance","updateScrollPosition","isOutside","_temporaryRemoved","_lastTriedX","_lastTriedY","updateScrollResize","size","width","height","_lastTriedW","_lastTriedH","subGrid","onParentResize","onEndMoving","gridToNotify","start","stop","drag","resize","movable","els","val","getElements","forEach","disable","enableMove","enableResize","_triggerEvent","enable","doEnable","includeNewWidgets","getGridItems","pluginClass","ddi","registerPlugin","GridStackEngine","getGridHeight","obsolete","getRow","column","onChange","_float","float","nodes","batchMode","_prevFloat","_packNodes","_notify","_sortNodes","nn","hasLocked","Boolean","find","moved","collisionNode","collide","area","isIntercepted","length","batchUpdate","copyNodes","_dirty","commit","dir","sort","i","_updating","_packY","newY","box","slice","bn","canBeMoved","_idSeq","defaults","Number","isNaN","min","verify","dirtNodes","_origY","_origX","_origW","_origH","filter","removeDOM","dirtyNodes","Array","isArray","concat","getDirtyNodes","triggerAddEvent","floor","_fixCollisions","triggerEvent","_layouts","isNodeChangedPosition","clonedNode","some","clone","map","canMove","row","noPack","reduce","memo","saveElement","widgets","key","_ignoreLayoutsNodeChange","layout","l","ratio","oldColumn","cacheLayout","cacheNodes","lastIndex","cacheNode","j","findIndex","newNodes","splice","move","scale","clear","copy","prop","GridDefaults","minRow","itemClass","placeholderClass","placeholderText","handle","handleClass","styleInHead","cellHeightThrottle","margin","auto","minWidth","animate","alwaysShowResizeHandle","autoHide","handles","scroll","appendTo","revert","rtl","marginUnit","cellHeightUnit","disableOneColumnMode","oneColumnModeDomSort","obsoleteOpts","obsoleteAttr","rowAttr","toNumber","getAttribute","toBool","_styleSheetClass","random","toFixed","initMargin","_widthOrContainer","_prevColumn","style","direction","parentGridItemEl","closestByClass","_isNested","_isAutoCellHeight","_setStaticClass","cbNodes","removeChild","_updateStyles","elements","parseInt","e","_prepareElement","saveInitial","setAnimation","_updateWindowResizeEvent","options","elOrString","getGridElement","gridstack","console","error","grids","getGridElements","parent","opt","doc","implementation","createHTMLDocument","body","innerHTML","class","children","init","load","_placeholder","placeholderChild","createElement","className","arguments","warn","a","id","addWidget","content","domAttr","_insertNotAppend","prepend","saveContent","saveGridOpt","list","save","sub","o","marginBottom","marginTop","marginRight","marginLeft","removeInternalAndSame","addAndRemove","items","removed","removeWidget","item","update","addGrid","forcePixel","marginDiff","data","parseHeight","unit","clientWidth","innerWidth","compact","domNodes","updateNodeWidths","from","setStatic","removeAll","_removeStylesheet","useDocRelative","containerPos","getBoundingClientRect","documentElement","scrollTop","offsetTop","offsetLeft","relativeLeft","relativeTop","columnWidth","rowHeight","isAreaEmpty","getElement","name","callback","indexOf","split","noData","detail","addEventListener","log","removeEventListener","doAnimate","m","keys","k","changed","ddChanged","value","layoutsNodesChange","CustomEvent","bubbles","Event","dispatchEvent","_styles","removeStylesheet","forceUpdate","prefix","styleLocation","createStylesheet","_max","addCSSRule","bottom","right","getHeight","rows","cssMinHeight","getComputedStyle","setAttribute","String","removeProperty","same","attrs","resizeHandles","removeAttribute","hasOwnProperty","classes","oneColumn","changedOneColumn","_oneColumnMode","_cellHeightThrottle","throttle","forceRemove","workTodo","_windowResizeBind","bind","margins","Engine","_disabled","_eventRegister","eventName","disabled","DDDraggable","DDBaseImplement","option","super","dragging","containmentRect","offset","substring","dragEl","contains","_dragStart","_drag","_dragEnd","_dragFollow","forDestroy","destroy","Object","DDManager","dragElement","_createHelper","_setupHelperContainmentStyle","dragOffset","_getDragOffset","helperContainment","ev","DDUtils","initEvent","_setupDragFollowNodeNotifyStart","dragFollowTimer","_cancelDragGhost","_setupHelperStyle","dragEventListenerOption","preventDefault","paintTimer","cancelAnimationFrame","parentOriginStylePosition","_removeHelperStyle","apply","dragElementOriginStyle","originStyleProp","pointerEvents","willChange","transition","basePosition","zIndex","requestAnimationFrame","clientX","clientY","match","img","dataTransfer","setDragImage","stopPropagation","xformOffsetX","xformOffsetY","testEl","addElStyles","opacity","testElPosition","targetOffset","DDDroppable","_dragEnter","_dragOver","_dragLeave","_drop","_setupAccept","moving","_removeLeaveCallbacks","_canDrop","over","_ui","relatedTarget","out","drop","DDElement","ddElement","ddDraggable","ddDroppable","ddResizable","updateOption","DDResizable","DDResizableHandle","host","_mouseDown","_mouseMove","_mouseUp","_init","userSelect","mouseDownEvent","s","abs","_showHandlers","_hideHandlers","newRect","originalRect","scrolled","rect","temporalRect","_setupAutoHide","_setupHandlers","_removeHandlers","updateHandles","updateAutoHide","handlerDirection","handlers","trim","_resizeStart","_resizeStop","_resizing","scrollEl","getScrollParent","scrollY","startEvent","_setupHelper","_applyChange","_getChange","_cleanHelper","elOriginStyleVal","_originStyleProp","oEvent","offsetX","offsetY","reshape","_getReShapeSize","oWidth","oHeight","maxWidth","MAX_SAFE_INTEGER","maxHeight","minHeight","containmentEl","test","styles","info","evt","obj","button","which","buttons","cancelable","p","isEventSupportPassiveOption","supportsPassive","passiveTest","GridStackDDNative","_getDDElements","dEl","cleanResizable","setupResizable","cleanDraggable","setupDraggable","containment","dragOut","_accept","cleanDroppable","setupDroppable","create","hosts","d","f","oldName","newName","rev","wrapper","args","oldAttr","querySelectorAll","getElementById","b","widths","styleSheet","cssText","createTextNode","insertBefore","firstChild","getElementsByTagName","sheet","rules","addRule","insertRule","v","toLowerCase","Error","parseFloat","sources","source","func","delay","isWaiting","overflow","overflowY","innerHeightOrClientHeight","innerHeight","clientHeight","offsetDiffDown","offsetDiffUp","prevScroll","scrollBy","behavior","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__"],"mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAmB,UAAID,IAEvBD,EAAgB,UAAIC,IARtB,CASGK,MAAM,WACT,M,wFCDA,eAEA,SACA,SAoBA,MAAsBC,U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W,EACtB+R,EAAShZ,EAAM6d,QAAUnW,EAAST,EAEpC3G,EAGFqhB,EAASwF,SAAS,CAAEC,SAAU,SAAU9mB,IAAKN,EAAM6d,QAAU5W,IACpD+R,GACT2I,EAASwF,SAAS,CAAEC,SAAU,SAAU9mB,IAAK2G,GAAYS,EAAS1H,EAAM6d,eCzV1EwJ,EAA2B,GCE/B,ODCA,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU/oB,QAG3C,IAAIC,EAAS4oB,EAAyBE,GAAY,CAGjD/oB,QAAS,IAOV,OAHAgpB,EAAoBD,GAAU9oB,EAAQA,EAAOD,QAAS8oB,GAG/C7oB,EAAOD,QCjBR8oB,CAAoB,M","file":"gridstack-h5.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"GridStack\"] = factory();\n\telse\n\t\troot[\"GridStack\"] = factory();\n})(self, function() {\nreturn ","// gridstack-GridStackDD.get().ts 3.3.0 @preserve\r\n\r\n/**\r\n * https://gridstackjs.com/\r\n * (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov\r\n * gridstack.js may be freely distributed under the MIT license.\r\n*/\r\n/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport { GridStackDDI } from './gridstack-ddi';\r\nimport { GridItemHTMLElement, GridStackNode, GridStackElement, DDUIData, DDDragInOpt } from './types';\r\nimport { GridStack } from './gridstack';\r\nimport { Utils } from './utils';\r\n\r\n/** Drag&Drop drop options */\r\nexport type DDDropOpt = {\r\n /** function or class type that this grid will accept as dropped items (see GridStackOptions.acceptWidgets) */\r\n accept?: (el: GridItemHTMLElement) => boolean;\r\n}\r\n\r\n/** drag&drop options currently called from the main code, but others can be passed in grid options */\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nexport type DDOpts = 'enable' | 'disable' | 'destroy' | 'option' | string | any;\r\nexport type DDKey = 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight';\r\nexport type DDValue = number | string;\r\n\r\n/** drag&drop events callbacks */\r\nexport type DDCallback = (event: Event, arg2: GridItemHTMLElement, helper?: GridItemHTMLElement) => void;\r\n\r\n/**\r\n * Base class implementing common Grid drag'n'drop functionality, with domain specific subclass (h5 vs jq subclasses)\r\n */\r\nexport abstract class GridStackDD extends GridStackDDI {\r\n\r\n /** override to cast to correct type */\r\n static get(): GridStackDD {\r\n return GridStackDDI.get() as GridStackDD;\r\n }\r\n\r\n /** removes any drag&drop present (called during destroy) */\r\n public remove(el: GridItemHTMLElement): GridStackDD {\r\n this.draggable(el, 'destroy').resizable(el, 'destroy');\r\n if (el.gridstackNode) {\r\n delete el.gridstackNode._initDD; // reset our DD init flag\r\n }\r\n return this;\r\n }\r\n\r\n // APIs that must be implemented by subclasses to do actual darg/drop/resize called by GridStack code below\r\n\r\n public abstract resizable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDD;\r\n\r\n public abstract isResizable(el: HTMLElement): boolean;\r\n\r\n public abstract draggable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDD;\r\n\r\n public abstract dragIn(el: GridStackElement, opts: DDDragInOpt): GridStackDD;\r\n\r\n public abstract isDraggable(el: HTMLElement): boolean;\r\n\r\n public abstract droppable(el: GridItemHTMLElement, opts: DDOpts | DDDropOpt, key?: DDKey, value?: DDValue): GridStackDD;\r\n\r\n public abstract isDroppable(el: HTMLElement): boolean;\r\n\r\n public abstract on(el: GridItemHTMLElement, eventName: string, callback: DDCallback): GridStackDD;\r\n\r\n public abstract off(el: GridItemHTMLElement, eventName: string): GridStackDD;\r\n}\r\n\r\n/********************************************************************************\r\n * GridStack code that is doing drag&drop extracted here so main class is smaller\r\n * for static grid that don't do any of this work anyway. Saves about 10k.\r\n * TODO: no code hint in code below as this is so look at alternatives ?\r\n * https://www.typescriptlang.org/docs/handbook/declaration-merging.html\r\n * https://www.typescriptlang.org/docs/handbook/mixins.html\r\n ********************************************************************************/\r\n\r\n/** @internal called to add drag over support to support widgets */\r\nGridStack.prototype._setupAcceptWidget = function(): GridStack {\r\n if (this.opts.staticGrid) return this;\r\n\r\n // if we don't accept external widgets (default) we still need to accept dragging within our\r\n // list of items (else we get a no-drop icon on windows)\r\n if (!this.opts.acceptWidgets) {\r\n GridStackDD.get().droppable(this.el, {\r\n accept: (el: GridItemHTMLElement) => el.gridstackNode && el.gridstackNode.grid === this\r\n })\r\n return this;\r\n }\r\n\r\n let onDrag = (event, el: GridItemHTMLElement) => {\r\n let node = el.gridstackNode;\r\n let pos = this.getCellFromPixel({left: event.pageX, top: event.pageY}, true);\r\n let x = Math.max(0, pos.x);\r\n let y = Math.max(0, pos.y);\r\n if (!node._added) {\r\n node.x = x;\r\n node.y = y;\r\n delete node.autoPosition;\r\n\r\n // don't accept *initial* location if doesn't fit #1419 (locked drop region, or can't grow), but maybe try if it will go somewhere\r\n if (!this.engine.willItFit(node)) {\r\n node.autoPosition = true; // ignore x,y and try for any slot...\r\n if (!this.engine.willItFit(node)) return; // full grid or can't grow\r\n }\r\n node._added = true;\r\n\r\n node.el = el;\r\n this.engine.cleanNodes();\r\n this.engine.beginUpdate(node);\r\n this.engine.addNode(node);\r\n\r\n this._writePosAttr(this.placeholder, node.x, node.y, node.w, node.h);\r\n this.el.appendChild(this.placeholder);\r\n node.el = this.placeholder; // dom we update while dragging...\r\n node._beforeDragX = node.x;\r\n node._beforeDragY = node.y;\r\n\r\n this._updateContainerHeight();\r\n } else if ((x !== node.x || y !== node.y) && this.engine.canMoveNode(node, x, y)) {\r\n this.engine.moveNode(node, x, y);\r\n this._updateContainerHeight();\r\n }\r\n };\r\n\r\n GridStackDD.get()\r\n .droppable(this.el, {\r\n accept: (el: GridItemHTMLElement) => {\r\n let node: GridStackNode = el.gridstackNode;\r\n // set accept drop to true on ourself (which we ignore) so we don't get \"can't drop\" icon in HTML5 mode while moving\r\n if (node && node.grid === this) return true;\r\n // check for accept method or class matching\r\n let canAccept = true;\r\n if (typeof this.opts.acceptWidgets === 'function') {\r\n canAccept = this.opts.acceptWidgets(el);\r\n } else {\r\n let selector = (this.opts.acceptWidgets === true ? '.grid-stack-item' : this.opts.acceptWidgets as string);\r\n canAccept = el.matches(selector);\r\n }\r\n // finally check to make sure we actually have space left #1571\r\n if (canAccept && node && this.opts.maxRow) {\r\n let n = {w: node.w, h: node.h, minW: node.minW, minH: node.minH}; // only width/height matters\r\n canAccept = this.engine.willItFit(n);\r\n }\r\n return canAccept;\r\n }\r\n })\r\n .on(this.el, 'dropover', (event, el: GridItemHTMLElement) => {\r\n // ignore drop enter on ourself, and prevent parent from receiving event\r\n let node = el.gridstackNode;\r\n if (node && node.grid === this) {\r\n delete node._added; // reset this to track placeholder again in case we were over other grid #1484 (dropout doesn't always clear)\r\n return false;\r\n }\r\n\r\n // load any element attributes if we don't have a node\r\n if (!node) {\r\n node = this._readAttr(el);\r\n }\r\n\r\n // if the item came from another grid, let it know it was added here to removed duplicate shadow #393\r\n if (node.grid && node.grid !== this) {\r\n node._added = true;\r\n }\r\n\r\n // if not calculate the grid size based on element outer size\r\n let w = node.w || Math.round(el.offsetWidth / this.cellWidth()) || 1;\r\n let h = node.h || Math.round(el.offsetHeight / this.getCellHeight(true)) || 1;\r\n\r\n // copy the node original values (min/max/id/etc...) but override width/height/other flags which are this grid specific\r\n let newNode = this.engine.prepareNode({...node, ...{w, h, _added: false, _temporary: true}});\r\n newNode._isOutOfGrid = true;\r\n el.gridstackNode = newNode;\r\n el._gridstackNodeOrig = node;\r\n\r\n GridStackDD.get().on(el, 'drag', onDrag);\r\n return false; // prevent parent from receiving msg (which may be grid as well)\r\n })\r\n .on(this.el, 'dropout', (event, el: GridItemHTMLElement) => {\r\n let node = el.gridstackNode;\r\n if (!node) return;\r\n\r\n // clear any added flag now that we are leaving #1484\r\n delete node._added;\r\n\r\n // jquery-ui bug. Must verify widget is being dropped out\r\n // check node variable that gets set when widget is out of grid\r\n if (!node._isOutOfGrid) {\r\n return;\r\n }\r\n\r\n GridStackDD.get().off(el, 'drag');\r\n node.el = null;\r\n this.engine.removeNode(node);\r\n if (this.placeholder.parentNode === this.el) {\r\n this.placeholder.remove();\r\n }\r\n this._updateContainerHeight();\r\n el.gridstackNode = el._gridstackNodeOrig;\r\n return false; // prevent parent from receiving msg (which may be grid as well)\r\n })\r\n .on(this.el, 'drop', (event, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n let node = el.gridstackNode;\r\n let wasAdded = !!this.placeholder.parentElement; // skip items not actually added to us because of constrains, but do cleanup #1419\r\n // ignore drop on ourself from ourself - dragend will handle the simple move instead\r\n if (node && node.grid === this) return false;\r\n\r\n this.placeholder.remove();\r\n\r\n // notify previous grid of removal\r\n let origNode = el._gridstackNodeOrig;\r\n delete el._gridstackNodeOrig;\r\n if (wasAdded && origNode && origNode.grid && origNode.grid !== this) {\r\n let oGrid = origNode.grid;\r\n oGrid.placeholder.remove();\r\n origNode.el = el; // was using placeholder, have it point to node we've moved instead\r\n oGrid.engine.removedNodes.push(origNode);\r\n oGrid._triggerRemoveEvent();\r\n }\r\n\r\n if (!node) return false;\r\n\r\n // use existing placeholder node as it's already in our list with drop location\r\n if (wasAdded) {\r\n const _id = node._id;\r\n this.engine.cleanupNode(node); // removes all internal _xyz values (including the _id so add that back)\r\n node._id = _id;\r\n node.grid = this;\r\n }\r\n GridStackDD.get().off(el, 'drag');\r\n // if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102)\r\n // as the helper will be nuked by jqueryui otherwise\r\n if (helper !== el) {\r\n helper.remove();\r\n el.gridstackNode = origNode; // original item (left behind) is re-stored to pre dragging as the node now has drop info\r\n if (wasAdded) {\r\n el = el.cloneNode(true) as GridItemHTMLElement;\r\n }\r\n } else {\r\n el.remove(); // reduce flicker as we change depth here, and size further down\r\n GridStackDD.get().remove(el);\r\n }\r\n if (!wasAdded) return false;\r\n el.gridstackNode = node;\r\n node.el = el;\r\n\r\n Utils.removePositioningStyles(el);\r\n this._writeAttr(el, node);\r\n this.el.appendChild(el);\r\n this._updateContainerHeight();\r\n this.engine.addedNodes.push(node);\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n\r\n this.engine.endUpdate();\r\n if (this._gsEventHandler['dropped']) {\r\n this._gsEventHandler['dropped']({type: 'dropped'}, origNode && origNode.grid ? origNode : undefined, node);\r\n }\r\n\r\n // wait till we return out of the drag callback to set the new drag&resize handler or they may get messed up\r\n // IFF we are still there (some application will use as placeholder and insert their real widget instead)\r\n window.setTimeout(() => {\r\n if (node.el && node.el.parentElement) this._prepareDragDropByNode(node);\r\n });\r\n\r\n return false; // prevent parent from receiving msg (which may be grid as well)\r\n });\r\n return this;\r\n}\r\n\r\n/** @internal called to setup a trash drop zone if the user specifies it */\r\nGridStack.prototype._setupRemoveDrop = function(): GridStack {\r\n if (!this.opts.staticGrid && typeof this.opts.removable === 'string') {\r\n let trashEl = document.querySelector(this.opts.removable) as HTMLElement;\r\n if (!trashEl) return this;\r\n // only register ONE dropover/dropout callback for the 'trash', and it will\r\n // update the passed in item and parent grid because the 'trash' is a shared resource anyway,\r\n // and Native DD only has 1 event CB (having a list and technically a per grid removableOptions complicates things greatly)\r\n if (!GridStackDD.get().isDroppable(trashEl)) {\r\n GridStackDD.get().droppable(trashEl, this.opts.removableOptions)\r\n .on(trashEl, 'dropover', function(event, el) { // don't use => notation to avoid using 'this' as grid by mistake...\r\n let node = el.gridstackNode;\r\n if (!node || !node.grid) return;\r\n el.dataset.inTrashZone = 'true';\r\n node.grid._setupRemovingTimeout(el);\r\n })\r\n .on(trashEl, 'dropout', function(event, el) { // same\r\n let node = el.gridstackNode;\r\n if (!node || !node.grid) return;\r\n delete el.dataset.inTrashZone;\r\n node.grid._clearRemovingTimeout(el);\r\n });\r\n }\r\n }\r\n return this;\r\n}\r\n\r\n/** @internal */\r\nGridStack.prototype._setupRemovingTimeout = function(el: GridItemHTMLElement): GridStack {\r\n let node = el.gridstackNode;\r\n if (!node || node._removeTimeout || !this.opts.removable) return this;\r\n node._removeTimeout = window.setTimeout(() => {\r\n el.classList.add('grid-stack-item-removing');\r\n node._isAboutToRemove = true;\r\n }, this.opts.removeTimeout);\r\n return this;\r\n}\r\n\r\n/** @internal */\r\nGridStack.prototype._clearRemovingTimeout = function(el: GridItemHTMLElement): GridStack {\r\n let node = el.gridstackNode;\r\n if (!node || !node._removeTimeout) return this;\r\n clearTimeout(node._removeTimeout);\r\n delete node._removeTimeout;\r\n el.classList.remove('grid-stack-item-removing');\r\n delete node._isAboutToRemove;\r\n return this;\r\n}\r\n\r\n/** @internal call to setup dragging in from the outside (say toolbar), with options */\r\nGridStack.prototype._setupDragIn = function(): GridStack {\r\n if (!this.opts.staticGrid && typeof this.opts.dragIn === 'string') {\r\n if (!GridStackDD.get().isDraggable(this.opts.dragIn)) {\r\n GridStackDD.get().dragIn(this.opts.dragIn, this.opts.dragInOptions);\r\n }\r\n }\r\n return this;\r\n}\r\n\r\n/** @internal prepares the element for drag&drop **/\r\nGridStack.prototype._prepareDragDropByNode = function(node: GridStackNode): GridStack {\r\n let el = node.el;\r\n\r\n // check for disabled grid first\r\n if (this.opts.staticGrid || node.locked ||\r\n ((node.noMove || this.opts.disableDrag) && (node.noResize || this.opts.disableResize))) {\r\n if (node._initDD) {\r\n GridStackDD.get().remove(node.el); // nukes everything instead of just disable, will add some styles back next\r\n delete node._initDD;\r\n }\r\n node.el.classList.add('ui-draggable-disabled', 'ui-resizable-disabled'); // add styles one might depend on #1435\r\n return this;\r\n }\r\n // check if init already done\r\n if (node._initDD) {\r\n // fine tune drag vs move by disabling any part...\r\n if (node.noMove || this.opts.disableDrag) {\r\n GridStackDD.get().draggable(el, 'disable');\r\n }\r\n if (node.noResize || this.opts.disableResize) {\r\n GridStackDD.get().resizable(el, 'disable');\r\n }\r\n return this;\r\n }\r\n\r\n // remove our style that look like D&D\r\n node.el.classList.remove('ui-draggable-disabled', 'ui-resizable-disabled');\r\n\r\n // variables used/cashed between the 3 start/move/end methods, in addition to node passed above\r\n let cellWidth: number;\r\n let cellHeight: number;\r\n\r\n /** called when item starts moving/resizing */\r\n let onStartMoving = (event: Event, ui: DDUIData): void => {\r\n let target = event.target as HTMLElement;\r\n\r\n // trigger any 'dragstart' / 'resizestart' manually\r\n if (this._gsEventHandler[event.type]) {\r\n this._gsEventHandler[event.type](event, target);\r\n }\r\n\r\n this.engine.cleanNodes();\r\n this.engine.beginUpdate(node);\r\n\r\n this._writePosAttr(this.placeholder, node.x, node.y, node.w, node.h)\r\n this.el.append(this.placeholder);\r\n\r\n node.el = this.placeholder;\r\n node._beforeDragX = node.x;\r\n node._beforeDragY = node.y;\r\n node._prevYPix = ui.position.top;\r\n\r\n // set the min/max resize info\r\n cellWidth = this.cellWidth();\r\n cellHeight = this.getCellHeight(true); // force pixels for calculations\r\n GridStackDD.get().resizable(el, 'option', 'minWidth', cellWidth * (node.minW || 1));\r\n GridStackDD.get().resizable(el, 'option', 'minHeight', cellHeight * (node.minH || 1));\r\n if (node.maxW) { GridStackDD.get().resizable(el, 'option', 'maxWidth', cellWidth * node.maxW); }\r\n if (node.maxH) { GridStackDD.get().resizable(el, 'option', 'maxHeight', cellHeight * node.maxH); }\r\n }\r\n\r\n /** called when item is being dragged/resized */\r\n let dragOrResize = (event: Event, ui: DDUIData): void => {\r\n let x = Math.round(ui.position.left / cellWidth);\r\n let y = Math.round(ui.position.top / cellHeight);\r\n let w: number;\r\n let h: number;\r\n let resizing: boolean;\r\n\r\n if (event.type === 'drag') {\r\n let distance = ui.position.top - node._prevYPix;\r\n node._prevYPix = ui.position.top;\r\n Utils.updateScrollPosition(el, ui.position, distance);\r\n // if inTrash, outside of the bounds or added to another grid (#393) temporarily remove it from us\r\n if (el.dataset.inTrashZone || node._added || this.engine.isOutside(x, y, node)) {\r\n if (node._temporaryRemoved) return;\r\n if (this.opts.removable === true) {\r\n this._setupRemovingTimeout(el);\r\n }\r\n\r\n x = node._beforeDragX;\r\n y = node._beforeDragY;\r\n\r\n if (this.placeholder.parentNode === this.el) {\r\n this.placeholder.remove();\r\n }\r\n this.engine.removeNode(node);\r\n this._updateContainerHeight();\r\n\r\n node._temporaryRemoved = true;\r\n delete node._added; // no need for this now\r\n } else {\r\n this._clearRemovingTimeout(el);\r\n\r\n if (node._temporaryRemoved) {\r\n this.engine.addNode(node);\r\n this._writePosAttr(this.placeholder, x, y, w, h);\r\n this.el.appendChild(this.placeholder);\r\n node.el = this.placeholder;\r\n delete node._temporaryRemoved;\r\n }\r\n }\r\n if (node._lastTriedX === x && node._lastTriedY === y) return;\r\n } else if (event.type === 'resize') {\r\n if (x < 0) return;\r\n // Scrolling page if needed\r\n Utils.updateScrollResize(event as MouseEvent, el, cellHeight);\r\n w = Math.round(ui.size.width / cellWidth);\r\n h = Math.round(ui.size.height / cellHeight);\r\n if (w === node.w && h === node.h) return;\r\n resizing = true;\r\n }\r\n\r\n if (!this.engine.canMoveNode(node, x, y, w, h)) return;\r\n node._lastTriedX = x;\r\n node._lastTriedY = y;\r\n node._lastTriedW = w;\r\n node._lastTriedH = h;\r\n this.engine.moveNode(node, x, y, w, h);\r\n if (resizing && node.subGrid) { (node.subGrid as GridStack).onParentResize(); }\r\n this._updateContainerHeight();\r\n }\r\n\r\n /** called when the item stops moving/resizing */\r\n let onEndMoving = (event: Event): void => {\r\n if (this.placeholder.parentNode === this.el) {\r\n this.placeholder.remove();\r\n }\r\n\r\n // if the item has moved to another grid, we're done here\r\n let target: GridItemHTMLElement = event.target as GridItemHTMLElement;\r\n if (!target.gridstackNode || target.gridstackNode.grid !== this) return;\r\n\r\n node.el = target;\r\n\r\n if (node._isAboutToRemove) {\r\n let gridToNotify = el.gridstackNode.grid;\r\n if (gridToNotify._gsEventHandler[event.type]) {\r\n gridToNotify._gsEventHandler[event.type](event, target);\r\n }\r\n gridToNotify.engine.removedNodes.push(node);\r\n GridStackDD.get().remove(el);\r\n delete el.gridstackNode; // hint we're removing it next and break circular link\r\n gridToNotify._triggerRemoveEvent();\r\n if (el.parentElement) {\r\n el.remove(); // finally remove it\r\n }\r\n } else {\r\n this._clearRemovingTimeout(el);\r\n if (!node._temporaryRemoved) {\r\n Utils.removePositioningStyles(target);\r\n this._writePosAttr(target, node.x, node.y, node.w, node.h);\r\n } else {\r\n Utils.removePositioningStyles(target);\r\n this._writePosAttr(target, node._beforeDragX, node._beforeDragY, node.w, node.h);\r\n node.x = node._beforeDragX;\r\n node.y = node._beforeDragY;\r\n delete node._temporaryRemoved;\r\n this.engine.addNode(node);\r\n }\r\n if (this._gsEventHandler[event.type]) {\r\n this._gsEventHandler[event.type](event, target);\r\n }\r\n }\r\n\r\n this._updateContainerHeight();\r\n this._triggerChangeEvent();\r\n\r\n this.engine.endUpdate();\r\n\r\n /* doing it on live resize instead\r\n // if we re-sized a nested grid item, let the children resize as well\r\n if (event.type === 'resizestop') {\r\n if (target.gridstackNode.subGrid) {(target.gridstackNode.subGrid as GridStack).onParentResize()}\r\n }\r\n */\r\n }\r\n\r\n GridStackDD.get()\r\n .draggable(el, {\r\n start: onStartMoving,\r\n stop: onEndMoving,\r\n drag: dragOrResize\r\n })\r\n .resizable(el, {\r\n start: onStartMoving,\r\n stop: onEndMoving,\r\n resize: dragOrResize\r\n });\r\n node._initDD = true; // we've set DD support now\r\n\r\n // finally fine tune drag vs move by disabling any part...\r\n if (node.noMove || this.opts.disableDrag) {\r\n GridStackDD.get().draggable(el, 'disable');\r\n }\r\n if (node.noResize || this.opts.disableResize) {\r\n GridStackDD.get().resizable(el, 'disable');\r\n }\r\n return this;\r\n}\r\n\r\n/**\r\n * Enables/Disables moving.\r\n * @param els widget or selector to modify.\r\n * @param val if true widget will be draggable.\r\n */\r\nGridStack.prototype.movable = function(els: GridStackElement, val: boolean): GridStack {\r\n if (this.opts.staticGrid) return this; // can't move a static grid!\r\n GridStack.getElements(els).forEach(el => {\r\n let node = el.gridstackNode;\r\n if (!node || node.locked) return;\r\n node.noMove = !(val || false);\r\n if (node.noMove) {\r\n GridStackDD.get().draggable(el, 'disable');\r\n el.classList.remove('ui-draggable-handle');\r\n } else {\r\n this._prepareDragDropByNode(node); // init DD if need be\r\n GridStackDD.get().draggable(el, 'enable');\r\n el.classList.remove('ui-draggable-handle');\r\n }\r\n });\r\n return this;\r\n}\r\n\r\n/**\r\n * Enables/Disables resizing.\r\n * @param els widget or selector to modify\r\n * @param val if true widget will be resizable.\r\n */\r\nGridStack.prototype.resizable = function(els: GridStackElement, val: boolean): GridStack {\r\n if (this.opts.staticGrid) return this; // can't resize a static grid!\r\n GridStack.getElements(els).forEach(el => {\r\n let node = el.gridstackNode;\r\n if (!node || node.locked) return;\r\n node.noResize = !(val || false);\r\n if (node.noResize) {\r\n GridStackDD.get().resizable(el, 'disable');\r\n } else {\r\n this._prepareDragDropByNode(node); // init DD if need be\r\n GridStackDD.get().resizable(el, 'enable');\r\n }\r\n });\r\n return this;\r\n}\r\n\r\n\r\n/**\r\n * Temporarily disables widgets moving/resizing.\r\n * If you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.\r\n * Note: no-op for static grid\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(false);\r\n * grid.enableResize(false);\r\n */\r\nGridStack.prototype.disable = function(): GridStack {\r\n if (this.opts.staticGrid) return;\r\n this.enableMove(false);\r\n this.enableResize(false);\r\n this._triggerEvent('disable');\r\n return this;\r\n}\r\n\r\n/**\r\n * Re-enables widgets moving/resizing - see disable().\r\n * Note: no-op for static grid.\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(true);\r\n * grid.enableResize(true);\r\n */\r\nGridStack.prototype.enable = function(): GridStack {\r\n if (this.opts.staticGrid) return;\r\n this.enableMove(true);\r\n this.enableResize(true);\r\n this._triggerEvent('enable');\r\n return this;\r\n}\r\n\r\n/**\r\n * Enables/disables widget moving. No-op for static grids.\r\n *\r\n * @param doEnable\r\n * @param includeNewWidgets will force new widgets to be draggable as per\r\n * doEnable`s value by changing the disableDrag grid option (default: true).\r\n */\r\nGridStack.prototype.enableMove = function(doEnable: boolean, includeNewWidgets = true): GridStack {\r\n if (this.opts.staticGrid) return this; // can't move a static grid!\r\n this.getGridItems().forEach(el => this.movable(el, doEnable));\r\n if (includeNewWidgets) {\r\n this.opts.disableDrag = !doEnable;\r\n }\r\n return this;\r\n}\r\n\r\n/**\r\n * Enables/disables widget resizing. No-op for static grids.\r\n * @param doEnable\r\n * @param includeNewWidgets will force new widgets to be draggable as per\r\n * doEnable`s value by changing the disableResize grid option (default: true).\r\n */\r\nGridStack.prototype.enableResize = function(doEnable: boolean, includeNewWidgets = true): GridStack {\r\n if (this.opts.staticGrid) return this; // can't size a static grid!\r\n this.getGridItems().forEach(el => this.resizable(el, doEnable));\r\n if (includeNewWidgets) {\r\n this.opts.disableResize = !doEnable;\r\n }\r\n return this;\r\n}\r\n","// gridstack-ddi.ts 3.3.0 @preserve\r\n\r\n/**\r\n * https://gridstackjs.com/\r\n * (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov\r\n * gridstack.js may be freely distributed under the MIT license.\r\n*/\r\n/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport { GridItemHTMLElement } from './types';\r\n\r\n/**\r\n * Abstract Partial Interface API for drag'n'drop plugin - look at GridStackDD and HTML5 / Jquery implementation versions\r\n */\r\nexport class GridStackDDI {\r\n\r\n protected static ddi: GridStackDDI;\r\n\r\n /** call this method to register your plugin instead of the default no-op one */\r\n static registerPlugin(pluginClass: typeof GridStackDDI): GridStackDDI {\r\n GridStackDDI.ddi = new pluginClass();\r\n return GridStackDDI.ddi;\r\n }\r\n\r\n /** get the current registered plugin to use */\r\n static get(): GridStackDDI {\r\n return GridStackDDI.ddi || GridStackDDI.registerPlugin(GridStackDDI);\r\n }\r\n\r\n /** removes any drag&drop present (called during destroy) */\r\n public remove(el: GridItemHTMLElement): GridStackDDI {\r\n return this; // no-op for static grids\r\n }\r\n}\r\n","// gridstack-engine.ts 3.3.0 @preserve\r\n\r\n/**\r\n * https://gridstackjs.com/\r\n * (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov\r\n * gridstack.js may be freely distributed under the MIT license.\r\n*/\r\n\r\nimport { Utils, obsolete } from './utils';\r\nimport { GridStackNode, ColumnOptions, GridStackWidget } from './types';\r\n\r\nexport type onChangeCB = (nodes: GridStackNode[], removeDOM?: boolean) => void;\r\n\r\n/** options used for creations - similar to GridStackOptions */\r\nexport interface GridStackEngineOptions {\r\n column?: number;\r\n maxRow?: number;\r\n float?: boolean;\r\n nodes?: GridStackNode[];\r\n onChange?: onChangeCB;\r\n}\r\n\r\n/**\r\n * Defines the GridStack engine that does most no DOM grid manipulation.\r\n * See GridStack methods and vars for descriptions.\r\n *\r\n * NOTE: values should not be modified directly - call the main GridStack API instead\r\n */\r\nexport class GridStackEngine {\r\n public column: number;\r\n public maxRow: number;\r\n public nodes: GridStackNode[];\r\n public onChange: onChangeCB;\r\n public addedNodes: GridStackNode[] = [];\r\n public removedNodes: GridStackNode[] = [];\r\n public batchMode: boolean;\r\n /** @internal */\r\n private _float: boolean;\r\n /** @internal */\r\n private _prevFloat: boolean;\r\n /** @internal */\r\n private _layouts?: Layout[][]; // maps column # to array of values nodes\r\n /** @internal */\r\n private _ignoreLayoutsNodeChange: boolean;\r\n /** @internal */\r\n private static _idSeq = 1;\r\n\r\n public constructor(opts: GridStackEngineOptions = {}) {\r\n this.column = opts.column || 12;\r\n this.onChange = opts.onChange;\r\n this._float = opts.float;\r\n this.maxRow = opts.maxRow;\r\n this.nodes = opts.nodes || [];\r\n }\r\n\r\n public batchUpdate(): GridStackEngine {\r\n if (this.batchMode) return this;\r\n this.batchMode = true;\r\n this._prevFloat = this._float;\r\n this._float = true; // let things go anywhere for now... commit() will restore and possibly reposition\r\n return this;\r\n }\r\n\r\n public commit(): GridStackEngine {\r\n if (!this.batchMode) return this;\r\n this.batchMode = false;\r\n this._float = this._prevFloat;\r\n delete this._prevFloat;\r\n this._packNodes();\r\n this._notify();\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n private _fixCollisions(node: GridStackNode): GridStackEngine {\r\n this._sortNodes(-1);\r\n\r\n let nn = node;\r\n let hasLocked = Boolean(this.nodes.find(n => n.locked));\r\n if (!this.float && !hasLocked) {\r\n nn = {x: 0, y: node.y, w: this.column, h: node.h};\r\n }\r\n while (true) {\r\n let collisionNode = this.collide(node, nn);\r\n if (!collisionNode) return this;\r\n let moved;\r\n if (collisionNode.locked) {\r\n // if colliding with a locked item, move ourself instead\r\n moved = this.moveNode(node, node.x, collisionNode.y + collisionNode.h,\r\n node.w, node.h, true);\r\n } else {\r\n moved = this.moveNode(collisionNode, collisionNode.x, node.y + node.h,\r\n collisionNode.w, collisionNode.h, true);\r\n }\r\n if (!moved) return this; // break inf loop if we couldn't move after all (ex: maxRow, fixed)\r\n }\r\n }\r\n\r\n /** return any intercepted node with the given area, skipping the passed in node (usually self) */\r\n public collide(node: GridStackNode, area: GridStackNode = node): GridStackNode {\r\n return this.nodes.find(n => n !== node && Utils.isIntercepted(n, area));\r\n }\r\n\r\n public isAreaEmpty(x: number, y: number, w: number, h: number): boolean {\r\n let nn: GridStackNode = {x: x || 0, y: y || 0, w: w || 1, h: h || 1};\r\n return !this.collide(nn);\r\n }\r\n\r\n /** re-layout grid items to reclaim any empty space */\r\n public compact(): GridStackEngine {\r\n if (this.nodes.length === 0) return this;\r\n this.batchUpdate();\r\n this._sortNodes();\r\n let copyNodes = this.nodes;\r\n this.nodes = []; // pretend we have no nodes to conflict layout to start with...\r\n copyNodes.forEach(node => {\r\n if (!node.noMove && !node.locked) {\r\n node.autoPosition = true;\r\n }\r\n this.addNode(node, false); // 'false' for add event trigger\r\n node._dirty = true; // force attr update\r\n });\r\n this.commit();\r\n return this;\r\n }\r\n\r\n /** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */\r\n public set float(val: boolean) {\r\n if (this._float === val) return;\r\n this._float = val || false;\r\n if (!val) {\r\n this._packNodes();\r\n this._notify();\r\n }\r\n }\r\n\r\n /** float getter method */\r\n public get float(): boolean { return this._float || false; }\r\n\r\n /** @internal */\r\n private _sortNodes(dir?: -1 | 1): GridStackEngine {\r\n this.nodes = Utils.sort(this.nodes, dir, this.column);\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n private _packNodes(): GridStackEngine {\r\n this._sortNodes();\r\n\r\n if (this.float) {\r\n this.nodes.forEach((n, i) => {\r\n if (n._updating || n._packY === undefined || n.y === n._packY) {\r\n return this;\r\n }\r\n let newY = n.y;\r\n while (newY >= n._packY) {\r\n let box: GridStackWidget = {x: n.x, y: newY, w: n.w, h: n.h};\r\n let collisionNode = this.nodes.slice(0, i).find(bn => Utils.isIntercepted(box, bn));\r\n if (!collisionNode) {\r\n n._dirty = true;\r\n n.y = newY;\r\n }\r\n --newY;\r\n }\r\n });\r\n } else {\r\n this.nodes.forEach((n, i) => {\r\n if (n.locked) return this;\r\n while (n.y > 0) {\r\n let newY = n.y - 1;\r\n let canBeMoved = i === 0;\r\n let box: GridStackWidget = {x: n.x, y: newY, w: n.w, h: n.h};\r\n if (i > 0) {\r\n let collisionNode = this.nodes.slice(0, i).find(bn => Utils.isIntercepted(box, bn));\r\n canBeMoved = !collisionNode;\r\n }\r\n\r\n if (!canBeMoved) { break; }\r\n // Note: must be dirty (from last position) for GridStack::OnChange CB to update positions\r\n // and move items back. The user 'change' CB should detect changes from the original\r\n // starting position instead.\r\n n._dirty = (n.y !== newY);\r\n n.y = newY;\r\n }\r\n });\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * given a random node, makes sure it's coordinates/values are valid in the current grid\r\n * @param node to adjust\r\n * @param resizing if out of bound, resize down or move into the grid to fit ?\r\n */\r\n public prepareNode(node: GridStackNode, resizing?: boolean): GridStackNode {\r\n node = node || {};\r\n node._id = node._id || GridStackEngine._idSeq++;\r\n\r\n // if we're missing position, have the grid position us automatically (before we set them to 0,0)\r\n if (node.x === undefined || node.y === undefined || node.x === null || node.y === null) {\r\n node.autoPosition = true;\r\n }\r\n\r\n // assign defaults for missing required fields\r\n let defaults: GridStackNode = { x: 0, y: 0, w: 1, h: 1};\r\n Utils.defaults(node, defaults);\r\n\r\n if (!node.autoPosition) { delete node.autoPosition; }\r\n if (!node.noResize) { delete node.noResize; }\r\n if (!node.noMove) { delete node.noMove; }\r\n\r\n // check for NaN (in case messed up strings were passed. can't do parseInt() || defaults.x above as 0 is valid #)\r\n if (typeof node.x == 'string') { node.x = Number(node.x); }\r\n if (typeof node.y == 'string') { node.y = Number(node.y); }\r\n if (typeof node.w == 'string') { node.w = Number(node.w); }\r\n if (typeof node.h == 'string') { node.h = Number(node.h); }\r\n if (isNaN(node.x)) { node.x = defaults.x; node.autoPosition = true; }\r\n if (isNaN(node.y)) { node.y = defaults.y; node.autoPosition = true; }\r\n if (isNaN(node.w)) { node.w = defaults.w; }\r\n if (isNaN(node.h)) { node.h = defaults.h; }\r\n\r\n if (node.maxW) { node.w = Math.min(node.w, node.maxW); }\r\n if (node.maxH) { node.h = Math.min(node.h, node.maxH); }\r\n if (node.minW) { node.w = Math.max(node.w, node.minW); }\r\n if (node.minH) { node.h = Math.max(node.h, node.minH); }\r\n\r\n if (node.w > this.column) {\r\n node.w = this.column;\r\n } else if (node.w < 1) {\r\n node.w = 1;\r\n }\r\n\r\n if (this.maxRow && node.h > this.maxRow) {\r\n node.h = this.maxRow;\r\n } else if (node.h < 1) {\r\n node.h = 1;\r\n }\r\n\r\n if (node.x < 0) {\r\n node.x = 0;\r\n }\r\n if (node.y < 0) {\r\n node.y = 0;\r\n }\r\n\r\n if (node.x + node.w > this.column) {\r\n if (resizing) {\r\n node.w = this.column - node.x;\r\n } else {\r\n node.x = this.column - node.w;\r\n }\r\n }\r\n if (this.maxRow && node.y + node.h > this.maxRow) {\r\n if (resizing) {\r\n node.h = this.maxRow - node.y;\r\n } else {\r\n node.y = this.maxRow - node.h;\r\n }\r\n }\r\n\r\n return node;\r\n }\r\n\r\n public getDirtyNodes(verify?: boolean): GridStackNode[] {\r\n // compare original X,Y,W,H (or entire node?) instead as _dirty can be a temporary state\r\n if (verify) {\r\n let dirtNodes: GridStackNode[] = [];\r\n this.nodes.forEach(n => {\r\n if (n._dirty) {\r\n if (n.y === n._origY && n.x === n._origX && n.w === n._origW && n.h === n._origH) {\r\n delete n._dirty;\r\n } else {\r\n dirtNodes.push(n);\r\n }\r\n }\r\n });\r\n return dirtNodes;\r\n }\r\n\r\n return this.nodes.filter(n => n._dirty);\r\n }\r\n\r\n /** @internal */\r\n private _notify(nodes?: GridStackNode | GridStackNode[], removeDOM = true): GridStackEngine {\r\n if (this.batchMode) return this;\r\n nodes = (nodes === undefined ? [] : (Array.isArray(nodes) ? nodes : [nodes]) );\r\n let dirtyNodes = nodes.concat(this.getDirtyNodes());\r\n if (this.onChange) {\r\n this.onChange(dirtyNodes, removeDOM);\r\n }\r\n return this;\r\n }\r\n\r\n public cleanNodes(): GridStackEngine {\r\n if (this.batchMode) return this;\r\n this.nodes.forEach(n => { delete n._dirty; });\r\n return this;\r\n }\r\n\r\n public addNode(node: GridStackNode, triggerAddEvent = false): GridStackNode {\r\n node = this.prepareNode(node);\r\n\r\n if (node.autoPosition) {\r\n this._sortNodes();\r\n\r\n for (let i = 0;; ++i) {\r\n let x = i % this.column;\r\n let y = Math.floor(i / this.column);\r\n if (x + node.w > this.column) {\r\n continue;\r\n }\r\n let box = {x, y, w: node.w, h: node.h};\r\n if (!this.nodes.find(n => Utils.isIntercepted(box, n))) {\r\n node.x = x;\r\n node.y = y;\r\n delete node.autoPosition; // found our slot\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.nodes.push(node);\r\n if (triggerAddEvent) {\r\n this.addedNodes.push(node);\r\n }\r\n\r\n this._fixCollisions(node);\r\n this._packNodes();\r\n this._notify();\r\n return node;\r\n }\r\n\r\n public removeNode(node: GridStackNode, removeDOM = true, triggerEvent = false): GridStackEngine {\r\n if (triggerEvent) { // we wait until final drop to manually track removed items (rather than during drag)\r\n this.removedNodes.push(node);\r\n }\r\n node._id = null; // hint that node is being removed\r\n // don't use 'faster' .splice(findIndex(),1) in case node isn't in our list, or in multiple times.\r\n this.nodes = this.nodes.filter(n => n !== node);\r\n if (!this.float) {\r\n this._packNodes();\r\n }\r\n this._notify(node, removeDOM);\r\n return this;\r\n }\r\n\r\n public removeAll(removeDOM = true): GridStackEngine {\r\n delete this._layouts;\r\n if (this.nodes.length === 0) return this;\r\n if (removeDOM) {\r\n this.nodes.forEach(n => { n._id = null; }); // hint that node is being removed\r\n }\r\n this.removedNodes = this.nodes;\r\n this.nodes = [];\r\n this._notify(this.removedNodes, removeDOM);\r\n return this;\r\n }\r\n\r\n public canMoveNode(node: GridStackNode, x: number, y: number, w?: number, h?: number): boolean {\r\n if (!this.isNodeChangedPosition(node, x, y, w, h)) {\r\n return false;\r\n }\r\n let hasLocked = this.nodes.some(n => n.locked);\r\n\r\n if (!this.maxRow && !hasLocked) {\r\n return true;\r\n }\r\n\r\n let clonedNode: GridStackNode;\r\n let clone = new GridStackEngine({\r\n column: this.column,\r\n float: this.float,\r\n nodes: this.nodes.map(n => {\r\n if (n === node) {\r\n clonedNode = {...n};\r\n return clonedNode;\r\n }\r\n return {...n};\r\n })\r\n });\r\n\r\n if (!clonedNode) return true;\r\n\r\n clone.moveNode(clonedNode, x, y, w, h);\r\n\r\n let canMove = true;\r\n if (hasLocked) {\r\n canMove = !clone.nodes.some(n => n.locked && n._dirty && n !== clonedNode);\r\n }\r\n if (this.maxRow && canMove) {\r\n canMove = (clone.getRow() <= this.maxRow);\r\n }\r\n\r\n return canMove;\r\n }\r\n\r\n /** return true if can fit in grid height constrain only (always true if no maxRow) */\r\n public willItFit(node: GridStackNode): boolean {\r\n if (!this.maxRow) return true;\r\n\r\n let clone = new GridStackEngine({\r\n column: this.column,\r\n float: this.float,\r\n nodes: this.nodes.map(n => {return {...n}})\r\n });\r\n clone.addNode(node);\r\n return clone.getRow() <= this.maxRow;\r\n }\r\n\r\n /** return true if the passed in node (x,y) is being dragged outside of the grid, and not added to bottom */\r\n public isOutside(x: number, y: number, node: GridStackNode): boolean {\r\n // simple outside boundaries\r\n if (x < 0 || x >= this.column || y < 0) return true;\r\n if (this.maxRow) return (y >= this.maxRow);\r\n else if (this.float) return false; // infinite grow with no maxRow\r\n\r\n // see if dragging PAST bottom (row+1)\r\n let row = this.getRow();\r\n if (y < row || y === 0) return false;\r\n if (y > row) return true;\r\n // else check to see if we can add that item to the bottom... (y == row)\r\n if (!node._temporaryRemoved) {\r\n let clone = new GridStackEngine({\r\n column: this.column,\r\n float: this.float,\r\n nodes: this.nodes.filter(n => n !== node).map(n => {return {...n}})\r\n });\r\n let nn = {...node, x, y};\r\n clone.addNode(nn);\r\n return nn.y === node.y && nn.x === node.x; // didn't actually move, so last row was a drag out and not a new place...\r\n }\r\n return node._temporaryRemoved; // if still outside so we don't flicker back & forth\r\n }\r\n\r\n public isNodeChangedPosition(node: GridStackNode, x: number, y: number, w?: number, h?: number): boolean {\r\n if (typeof x !== 'number') { x = node.x; }\r\n if (typeof y !== 'number') { y = node.y; }\r\n if (typeof w !== 'number') { w = node.w; }\r\n if (typeof h !== 'number') { h = node.h; }\r\n\r\n if (node.maxW) { w = Math.min(w, node.maxW); }\r\n if (node.maxH) { h = Math.min(h, node.maxH); }\r\n if (node.minW) { w = Math.max(w, node.minW); }\r\n if (node.minH) { h = Math.max(h, node.minH); }\r\n\r\n if (node.x === x && node.y === y && node.w === w && node.h === h) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n public moveNode(node: GridStackNode, x: number, y: number, w?: number, h?: number, noPack?: boolean): GridStackNode {\r\n if (node.locked) return null;\r\n if (typeof x !== 'number') { x = node.x; }\r\n if (typeof y !== 'number') { y = node.y; }\r\n if (typeof w !== 'number') { w = node.w; }\r\n if (typeof h !== 'number') { h = node.h; }\r\n\r\n // constrain the passed in values and check if we're still changing our node\r\n let resizing = (node.w !== w || node.h !== h);\r\n let nn: GridStackNode = { x, y, w, h, maxW: node.maxW, maxH: node.maxH, minW: node.minW, minH: node.minH};\r\n nn = this.prepareNode(nn, resizing);\r\n if (node.x === nn.x && node.y === nn.y && node.w === nn.w && node.h === nn.h) {\r\n return null;\r\n }\r\n\r\n node._dirty = true;\r\n\r\n node.x = node._lastTriedX = nn.x;\r\n node.y = node._lastTriedY = nn.y;\r\n node.w = node._lastTriedW = nn.w;\r\n node.h = node._lastTriedH = nn.h;\r\n\r\n this._fixCollisions(node);\r\n if (!noPack) {\r\n this._packNodes();\r\n this._notify();\r\n }\r\n return node;\r\n }\r\n\r\n public getRow(): number {\r\n return this.nodes.reduce((memo, n) => Math.max(memo, n.y + n.h), 0);\r\n }\r\n\r\n public beginUpdate(node: GridStackNode): GridStackEngine {\r\n if (node._updating) return this;\r\n node._updating = true;\r\n this.nodes.forEach(n => { n._packY = n.y; });\r\n return this;\r\n }\r\n\r\n public endUpdate(): GridStackEngine {\r\n let n = this.nodes.find(n => n._updating);\r\n if (n) {\r\n delete n._updating;\r\n this.nodes.forEach(n => { delete n._packY; });\r\n }\r\n return this;\r\n }\r\n\r\n /** saves the current layout returning a list of widgets for serialization */\r\n public save(saveElement = true): GridStackNode[] {\r\n let widgets: GridStackNode[] = [];\r\n Utils.sort(this.nodes);\r\n this.nodes.forEach(n => {\r\n let w: GridStackNode = {};\r\n for (let key in n) { if (key[0] !== '_' && n[key] !== null && n[key] !== undefined ) w[key] = n[key]; }\r\n // delete other internals\r\n if (!saveElement) delete w.el;\r\n delete w.grid;\r\n // delete default values (will be re-created on read)\r\n if (!w.autoPosition) delete w.autoPosition;\r\n if (!w.noResize) delete w.noResize;\r\n if (!w.noMove) delete w.noMove;\r\n if (!w.locked) delete w.locked;\r\n widgets.push(w);\r\n });\r\n return widgets;\r\n }\r\n\r\n /** @internal called whenever a node is added or moved - updates the cached layouts */\r\n public layoutsNodesChange(nodes: GridStackNode[]): GridStackEngine {\r\n if (!this._layouts || this._ignoreLayoutsNodeChange) return this;\r\n // remove smaller layouts - we will re-generate those on the fly... larger ones need to update\r\n this._layouts.forEach((layout, column) => {\r\n if (!layout || column === this.column) return this;\r\n if (column < this.column) {\r\n this._layouts[column] = undefined;\r\n }\r\n else {\r\n // we save the original x,y,w (h isn't cached) to see what actually changed to propagate better.\r\n // Note: we don't need to check against out of bound scaling/moving as that will be done when using those cache values.\r\n nodes.forEach(node => {\r\n let n = layout.find(l => l._id === node._id);\r\n if (!n) return this; // no cache for new nodes. Will use those values.\r\n let ratio = column / this.column;\r\n // Y changed, push down same amount\r\n // TODO: detect doing item 'swaps' will help instead of move (especially in 1 column mode)\r\n if (node.y !== node._origY) {\r\n n.y += (node.y - node._origY);\r\n }\r\n // X changed, scale from new position\r\n if (node.x !== node._origX) {\r\n n.x = Math.round(node.x * ratio);\r\n }\r\n // width changed, scale from new width\r\n if (node.w !== node._origW) {\r\n n.w = Math.round(node.w * ratio);\r\n }\r\n // ...height always carries over from cache\r\n });\r\n }\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * @internal Called to scale the widget width & position up/down based on the column change.\r\n * Note we store previous layouts (especially original ones) to make it possible to go\r\n * from say 12 -> 1 -> 12 and get back to where we were.\r\n *\r\n * @param oldColumn previous number of columns\r\n * @param column new column number\r\n * @param nodes different sorted list (ex: DOM order) instead of current list\r\n * @param layout specify the type of re-layout that will happen (position, size, etc...).\r\n * Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column\r\n */\r\n public updateNodeWidths(oldColumn: number, column: number, nodes: GridStackNode[], layout: ColumnOptions = 'moveScale'): GridStackEngine {\r\n if (!this.nodes.length || oldColumn === column) return this;\r\n\r\n // cache the current layout in case they want to go back (like 12 -> 1 -> 12) as it requires original data\r\n this.cacheLayout(this.nodes, oldColumn);\r\n\r\n // if we're going to 1 column and using DOM order rather than default sorting, then generate that layout\r\n if (column === 1 && nodes && nodes.length) {\r\n let top = 0;\r\n nodes.forEach(n => {\r\n n.x = 0;\r\n n.w = 1;\r\n n.y = Math.max(n.y, top);\r\n top = n.y + n.h;\r\n });\r\n } else {\r\n nodes = Utils.sort(this.nodes, -1, oldColumn); // current column reverse sorting so we can insert last to front (limit collision)\r\n }\r\n\r\n // see if we have cached previous layout.\r\n let cacheNodes = this._layouts[column] || [];\r\n // if not AND we are going up in size start with the largest layout as down-scaling is more accurate\r\n let lastIndex = this._layouts.length - 1;\r\n if (cacheNodes.length === 0 && column > oldColumn && column < lastIndex) {\r\n cacheNodes = this._layouts[lastIndex] || [];\r\n if (cacheNodes.length) {\r\n // pretend we came from that larger column by assigning those values as starting point\r\n oldColumn = lastIndex;\r\n cacheNodes.forEach(cacheNode => {\r\n let j = nodes.findIndex(n => n._id === cacheNode._id);\r\n if (j !== -1) {\r\n // still current, use cache info positions\r\n nodes[j].x = cacheNode.x;\r\n nodes[j].y = cacheNode.y;\r\n nodes[j].w = cacheNode.w;\r\n }\r\n });\r\n cacheNodes = []; // we still don't have new column cached data... will generate from larger one.\r\n }\r\n }\r\n\r\n // if we found cache re-use those nodes that are still current\r\n let newNodes: GridStackNode[] = [];\r\n cacheNodes.forEach(cacheNode => {\r\n let j = nodes.findIndex(n => n._id === cacheNode._id);\r\n if (j !== -1) {\r\n // still current, use cache info positions\r\n nodes[j].x = cacheNode.x;\r\n nodes[j].y = cacheNode.y;\r\n nodes[j].w = cacheNode.w;\r\n newNodes.push(nodes[j]);\r\n nodes.splice(j, 1);\r\n }\r\n });\r\n // ...and add any extra non-cached ones\r\n if (nodes.length) {\r\n if (typeof layout === 'function') {\r\n layout(column, oldColumn, newNodes, nodes);\r\n } else {\r\n let ratio = column / oldColumn;\r\n let move = (layout === 'move' || layout === 'moveScale');\r\n let scale = (layout === 'scale' || layout === 'moveScale');\r\n nodes.forEach(node => {\r\n node.x = (column === 1 ? 0 : (move ? Math.round(node.x * ratio) : Math.min(node.x, column - 1)));\r\n node.w = ((column === 1 || oldColumn === 1) ? 1 :\r\n scale ? (Math.round(node.w * ratio) || 1) : (Math.min(node.w, column)));\r\n newNodes.push(node);\r\n });\r\n nodes = [];\r\n }\r\n }\r\n\r\n // finally re-layout them in reverse order (to get correct placement)\r\n newNodes = Utils.sort(newNodes, -1, column);\r\n this._ignoreLayoutsNodeChange = true;\r\n this.batchUpdate();\r\n this.nodes = []; // pretend we have no nodes to start with (we use same structures) to simplify layout\r\n newNodes.forEach(node => {\r\n this.addNode(node, false); // 'false' for add event trigger\r\n node._dirty = true; // force attr update\r\n }, this);\r\n this.commit();\r\n delete this._ignoreLayoutsNodeChange;\r\n return this;\r\n }\r\n\r\n /** @internal called to save initial position/size */\r\n public saveInitial(): GridStackEngine {\r\n this.nodes.forEach(n => {\r\n n._origX = n.x;\r\n n._origY = n.y;\r\n n._origW = n.w;\r\n n._origH = n.h;\r\n delete n._dirty;\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * call to cache the given layout internally to the given location so we can restore back when column changes size\r\n * @param nodes list of nodes\r\n * @param column corresponding column index to save it under\r\n * @param clear if true, will force other caches to be removed (default false)\r\n */\r\n public cacheLayout(nodes: GridStackNode[], column: number, clear = false): GridStackEngine {\r\n let copy: Layout[] = [];\r\n nodes.forEach((n, i) => {\r\n n._id = n._id || GridStackEngine._idSeq++; // make sure we have an id in case this is new layout, else re-use id already set\r\n copy[i] = {x: n.x, y: n.y, w: n.w, _id: n._id} // only thing we change is x,y,w and id to find it back\r\n });\r\n this._layouts = clear ? [] : this._layouts || []; // use array to find larger quick\r\n this._layouts[column] = copy;\r\n return this;\r\n }\r\n\r\n\r\n /** called to remove all internal values */\r\n public cleanupNode(node: GridStackNode): GridStackEngine {\r\n for (let prop in node) {\r\n if (prop[0] === '_') delete node[prop];\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal legacy method renames */\r\n private getGridHeight = obsolete(this, GridStackEngine.prototype.getRow, 'getGridHeight', 'getRow', 'v1.0.0');\r\n}\r\n\r\n/** @internal class to store per column layout bare minimal info (subset of GridStackWidget) */\r\ninterface Layout {\r\n x: number;\r\n y: number;\r\n w: number;\r\n _id: number; // so we can find full node back\r\n}\r\n","// gridstack.ts 3.3.0 @preserve\r\n\r\n/**\r\n * https://gridstackjs.com/\r\n * (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov\r\n * gridstack.js may be freely distributed under the MIT license.\r\n*/\r\n\r\nimport { GridStackEngine } from './gridstack-engine';\r\nimport { obsoleteOpts, obsoleteAttr, Utils, HeightData } from './utils';\r\nimport { GridStackElement, GridItemHTMLElement, GridStackWidget, GridStackNode, GridStackOptions, numberOrString, ColumnOptions } from './types';\r\nimport { GridStackDDI } from './gridstack-ddi';\r\n\r\n// export all dependent file as well to make it easier for users to just import the main file\r\nexport * from './types';\r\nexport * from './utils';\r\nexport * from './gridstack-engine';\r\nexport * from './gridstack-ddi';\r\n\r\nexport interface GridHTMLElement extends HTMLElement {\r\n gridstack?: GridStack; // grid's parent DOM element points back to grid class\r\n}\r\nexport type GridStackEvent = 'added' | 'change' | 'disable' | 'dragstart' | 'dragstop' | 'dropped' |\r\n 'enable' | 'removed' | 'resizestart' | 'resizestop';\r\n\r\n/** Defines the coordinates of an object */\r\nexport interface MousePosition {\r\n top: number;\r\n left: number;\r\n}\r\n\r\n/** Defines the position of a cell inside the grid*/\r\nexport interface CellPosition {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ninterface GridCSSStyleSheet extends CSSStyleSheet {\r\n _id?: string; // random id we will use to style us\r\n _max?: number; // internal tracker of the max # of rows we created\\\r\n}\r\n\r\n// default values for grid options - used during init and when saving out\r\nconst GridDefaults: GridStackOptions = {\r\n column: 12,\r\n minRow: 0,\r\n maxRow: 0,\r\n itemClass: 'grid-stack-item',\r\n placeholderClass: 'grid-stack-placeholder',\r\n placeholderText: '',\r\n handle: '.grid-stack-item-content',\r\n handleClass: null,\r\n styleInHead: false,\r\n cellHeight: 'auto',\r\n cellHeightThrottle: 100,\r\n margin: 10,\r\n auto: true,\r\n minWidth: 768,\r\n float: false,\r\n staticGrid: false,\r\n animate: true,\r\n alwaysShowResizeHandle: false,\r\n resizable: {\r\n autoHide: true,\r\n handles: 'se'\r\n },\r\n draggable: {\r\n handle: '.grid-stack-item-content',\r\n scroll: false,\r\n appendTo: 'body'\r\n },\r\n dragIn: undefined,\r\n dragInOptions : {\r\n revert: 'invalid',\r\n handle: '.grid-stack-item-content',\r\n scroll: false,\r\n appendTo: 'body'\r\n },\r\n disableDrag: false,\r\n disableResize: false,\r\n rtl: 'auto',\r\n removable: false,\r\n removableOptions: {\r\n accept: '.grid-stack-item'\r\n },\r\n removeTimeout: 2000,\r\n marginUnit: 'px',\r\n cellHeightUnit: 'px',\r\n disableOneColumnMode: false,\r\n oneColumnModeDomSort: false\r\n};\r\n\r\n/**\r\n * Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.\r\n * Note: your grid elements MUST have the following classes for the CSS layout to work:\r\n * @example\r\n *
\r\n *
\r\n *
Item 1
\r\n *
\r\n *
\r\n */\r\nexport class GridStack {\r\n\r\n /**\r\n * initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will\r\n * simply return the existing instance (ignore any passed options). There is also an initAll() version that support\r\n * multiple grids initialization at once. Or you can use addGrid() to create the entire grid from JSON.\r\n * @param options grid options (optional)\r\n * @param elOrString element or CSS selector (first one used) to convert to a grid (default to '.grid-stack' class selector)\r\n *\r\n * @example\r\n * let grid = GridStack.init();\r\n *\r\n * Note: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later\r\n * let grid = document.querySelector('.grid-stack').gridstack;\r\n */\r\n public static init(options: GridStackOptions = {}, elOrString: GridStackElement = '.grid-stack'): GridStack {\r\n let el = GridStack.getGridElement(elOrString);\r\n if (!el) {\r\n if (typeof elOrString === 'string') {\r\n console.error('GridStack.initAll() no grid was found with selector \"' + elOrString + '\" - element missing or wrong selector ?' +\r\n '\\nNote: \".grid-stack\" is required for proper CSS styling and drag/drop, and is the default selector.');\r\n } else {\r\n console.error('GridStack.init() no grid element was passed.');\r\n }\r\n return null;\r\n }\r\n if (!el.gridstack) {\r\n el.gridstack = new GridStack(el, {...options});\r\n }\r\n return el.gridstack\r\n }\r\n\r\n /**\r\n * Will initialize a list of elements (given a selector) and return an array of grids.\r\n * @param options grid options (optional)\r\n * @param selector elements selector to convert to grids (default to '.grid-stack' class selector)\r\n *\r\n * @example\r\n * let grids = GridStack.initAll();\r\n * grids.forEach(...)\r\n */\r\n public static initAll(options: GridStackOptions = {}, selector = '.grid-stack'): GridStack[] {\r\n let grids: GridStack[] = [];\r\n GridStack.getGridElements(selector).forEach(el => {\r\n if (!el.gridstack) {\r\n el.gridstack = new GridStack(el, {...options});\r\n }\r\n grids.push(el.gridstack);\r\n });\r\n if (grids.length === 0) {\r\n console.error('GridStack.initAll() no grid was found with selector \"' + selector + '\" - element missing or wrong selector ?' +\r\n '\\nNote: \".grid-stack\" is required for proper CSS styling and drag/drop, and is the default selector.');\r\n }\r\n return grids;\r\n }\r\n\r\n /**\r\n * call to create a grid with the given options, including loading any children from JSON structure. This will call GridStack.init(), then\r\n * grid.load() on any passed children (recursively). Great alternative to calling init() if you want entire grid to come from\r\n * JSON serialized data, including options.\r\n * @param parent HTML element parent to the grid\r\n * @param opt grids options used to initialize the grid, and list of children\r\n */\r\n public static addGrid(parent: HTMLElement, opt: GridStackOptions = {}): GridStack {\r\n if (!parent) return null;\r\n\r\n // create the grid element\r\n let doc = document.implementation.createHTMLDocument();\r\n doc.body.innerHTML = `
`;\r\n let el = doc.body.children[0] as HTMLElement;\r\n parent.append(el);\r\n\r\n // create grid class and load any children\r\n let grid = GridStack.init(opt, el);\r\n if (opt.children) {\r\n grid.load(opt.children);\r\n }\r\n return grid;\r\n }\r\n\r\n /** scoping so users can call GridStack.Utils.sort() for example */\r\n public static Utils = Utils;\r\n\r\n /** scoping so users can call new GridStack.Engine(12) for example */\r\n public static Engine = GridStackEngine;\r\n\r\n /** the HTML element tied to this grid after it's been initialized */\r\n public el: GridHTMLElement;\r\n\r\n /** engine used to implement non DOM grid functionality */\r\n public engine: GridStackEngine;\r\n\r\n /** grid options - public for classes to access, but use methods to modify! */\r\n public opts: GridStackOptions;\r\n\r\n /** @internal create placeholder DIV as needed */\r\n public get placeholder(): HTMLElement {\r\n if (!this._placeholder) {\r\n let placeholderChild = document.createElement('div'); // child so padding match item-content\r\n placeholderChild.className = 'placeholder-content';\r\n if (this.opts.placeholderText) {\r\n placeholderChild.innerHTML = this.opts.placeholderText;\r\n }\r\n this._placeholder = document.createElement('div');\r\n this._placeholder.classList.add(this.opts.placeholderClass, GridDefaults.itemClass, this.opts.itemClass);\r\n this.placeholder.appendChild(placeholderChild);\r\n }\r\n return this._placeholder;\r\n }\r\n /** @internal */\r\n private _placeholder: HTMLElement;\r\n /** @internal */\r\n private _oneColumnMode: boolean;\r\n /** @internal */\r\n private _prevColumn: number;\r\n /** @internal */\r\n private _ignoreLayoutsNodeChange: boolean;\r\n /** @internal */\r\n public _gsEventHandler = {};\r\n /** @internal */\r\n private _styles: GridCSSStyleSheet;\r\n /** @internal flag to keep cells square during resize */\r\n private _isAutoCellHeight: boolean;\r\n /** @internal track event binding to window resize so we can remove */\r\n private _windowResizeBind: () => void;\r\n /** @internal limit auto cell resizing method */\r\n private _cellHeightThrottle: () => void;\r\n /** @internal true when loading items to insert first rather than append */\r\n private _insertNotAppend: boolean;\r\n\r\n /**\r\n * Construct a grid item from the given element and options\r\n * @param el\r\n * @param opts\r\n */\r\n public constructor(el: GridHTMLElement, opts: GridStackOptions = {}) {\r\n this.el = el; // exposed HTML element to the user\r\n opts = opts || {}; // handles null/undefined/0\r\n\r\n obsoleteOpts(opts, 'verticalMargin', 'margin', 'v2.0');\r\n\r\n obsoleteAttr(this.el, 'data-gs-current-height', 'gs-current-row', 'v1.0.0');\r\n\r\n // if row property exists, replace minRow and maxRow instead\r\n if (opts.row) {\r\n opts.minRow = opts.maxRow = opts.row;\r\n delete opts.row;\r\n }\r\n let rowAttr = Utils.toNumber(el.getAttribute('gs-row'));\r\n\r\n // elements attributes override any passed options (like CSS style) - merge the two together\r\n let defaults: GridStackOptions = {...GridDefaults,\r\n column: Utils.toNumber(el.getAttribute('gs-column')) || 12,\r\n minRow: rowAttr ? rowAttr : Utils.toNumber(el.getAttribute('gs-min-row')) || 0,\r\n maxRow: rowAttr ? rowAttr : Utils.toNumber(el.getAttribute('gs-max-row')) || 0,\r\n staticGrid: Utils.toBool(el.getAttribute('gs-static')) || false,\r\n _styleSheetClass: 'grid-stack-instance-' + (Math.random() * 10000).toFixed(0),\r\n alwaysShowResizeHandle: opts.alwaysShowResizeHandle || false,\r\n resizable: {\r\n autoHide: !(opts.alwaysShowResizeHandle || false),\r\n handles: 'se'\r\n },\r\n draggable: {\r\n handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || '.grid-stack-item-content',\r\n scroll: false,\r\n appendTo: 'body'\r\n },\r\n removableOptions: {\r\n accept: '.' + (opts.itemClass || 'grid-stack-item')\r\n },\r\n };\r\n if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead\r\n defaults.animate = Utils.toBool(el.getAttribute('gs-animate'))\r\n }\r\n\r\n this.opts = Utils.defaults(opts, defaults);\r\n opts = null; // make sure we use this.opts instead\r\n this.initMargin(); // part of settings defaults...\r\n\r\n // Now check if we're loading into 1 column mode FIRST so we don't do un-necessary work (like cellHeight = width / 12 then go 1 column)\r\n if (this.opts.column !== 1 && !this.opts.disableOneColumnMode && this._widthOrContainer() <= this.opts.minWidth) {\r\n this._prevColumn = this.opts.column;\r\n this.opts.column = 1;\r\n }\r\n\r\n if (this.opts.rtl === 'auto') {\r\n this.opts.rtl = (el.style.direction === 'rtl');\r\n }\r\n\r\n if (this.opts.rtl) {\r\n this.el.classList.add('grid-stack-rtl');\r\n }\r\n\r\n // check if we're been nested, and if so update our style and keep pointer around (used during save)\r\n let parentGridItemEl = Utils.closestByClass(this.el, GridDefaults.itemClass) as GridItemHTMLElement;\r\n if (parentGridItemEl && parentGridItemEl.gridstackNode) {\r\n this.opts._isNested = parentGridItemEl.gridstackNode;\r\n this.opts._isNested.subGrid = this;\r\n this.el.classList.add('grid-stack-nested');\r\n }\r\n\r\n this._isAutoCellHeight = (this.opts.cellHeight === 'auto');\r\n if (this._isAutoCellHeight || this.opts.cellHeight === 'initial') {\r\n // make the cell content square initially (will use resize event to keep it square)\r\n this.cellHeight(undefined, false);\r\n } else {\r\n this.cellHeight(this.opts.cellHeight, false);\r\n }\r\n\r\n this.el.classList.add(this.opts._styleSheetClass);\r\n\r\n this._setStaticClass();\r\n\r\n this.engine = new GridStackEngine({\r\n column: this.opts.column,\r\n float: this.opts.float,\r\n maxRow: this.opts.maxRow,\r\n onChange: (cbNodes, removeDOM = true) => {\r\n let maxH = 0;\r\n this.engine.nodes.forEach(n => { maxH = Math.max(maxH, n.y + n.h) });\r\n cbNodes.forEach(n => {\r\n let el = n.el;\r\n if (removeDOM && n._id === null) {\r\n if (el && el.parentNode) { el.parentNode.removeChild(el) }\r\n } else {\r\n this._writePosAttr(el, n.x, n.y, n.w, n.h);\r\n }\r\n });\r\n this._updateStyles(false, maxH); // false = don't recreate, just append if need be\r\n }\r\n });\r\n\r\n if (this.opts.auto) {\r\n this.batchUpdate(); // prevent in between re-layout #1535 TODO: this only set float=true, need to prevent collision check...\r\n let elements: {el: HTMLElement; i: number}[] = [];\r\n this.getGridItems().forEach(el => {\r\n let x = parseInt(el.getAttribute('gs-x'));\r\n let y = parseInt(el.getAttribute('gs-y'));\r\n elements.push({\r\n el,\r\n // if x,y are missing (autoPosition) add them to end of list - but keep their respective DOM order\r\n i: (Number.isNaN(x) ? 1000 : x) + (Number.isNaN(y) ? 1000 : y) * this.opts.column\r\n });\r\n });\r\n elements.sort(e => e.i).forEach(e => this._prepareElement(e.el));\r\n this.commit();\r\n }\r\n this.engine.saveInitial(); // initial start of items\r\n\r\n this.setAnimation(this.opts.animate);\r\n\r\n this._updateStyles();\r\n if (this.opts.column != 12) {\r\n this.el.classList.add('grid-stack-' + this.opts.column);\r\n }\r\n\r\n this._setupDragIn();\r\n this._setupRemoveDrop();\r\n this._setupAcceptWidget();\r\n this._updateWindowResizeEvent();\r\n }\r\n\r\n /**\r\n * add a new widget and returns it.\r\n *\r\n * Widget will be always placed even if result height is more than actual grid height.\r\n * You need to use `willItFit()` before calling addWidget for additional check.\r\n * See also `makeWidget()`.\r\n *\r\n * @example\r\n * let grid = GridStack.init();\r\n * grid.addWidget({w: 3, content: 'hello'});\r\n * grid.addWidget('
hello
', {w: 3});\r\n *\r\n * @param el GridStackWidget (which can have content string as well), html element, or string definition to add\r\n * @param options widget position/size options (optional, and ignore if first param is already option) - see GridStackWidget\r\n */\r\n public addWidget(els?: GridStackWidget | GridStackElement, options?: GridStackWidget): GridItemHTMLElement {\r\n\r\n // support legacy call for now ?\r\n if (arguments.length > 2) {\r\n console.warn('gridstack.ts: `addWidget(el, x, y, width...)` is deprecated. Use `addWidget({x, y, w, content, ...})`. It will be removed soon');\r\n // eslint-disable-next-line prefer-rest-params\r\n let a = arguments, i = 1,\r\n opt: GridStackWidget = { x:a[i++], y:a[i++], w:a[i++], h:a[i++], autoPosition:a[i++],\r\n minW:a[i++], maxW:a[i++], minH:a[i++], maxH:a[i++], id:a[i++] };\r\n return this.addWidget(els, opt);\r\n }\r\n\r\n function isGridStackWidget(w: GridStackWidget): w is GridStackWidget { // https://medium.com/ovrsea/checking-the-type-of-an-object-in-typescript-the-type-guards-24d98d9119b0\r\n return w.x !== undefined || w.y !== undefined || w.w !== undefined || w.h !== undefined || w.content !== undefined ? true : false;\r\n }\r\n\r\n let el: HTMLElement;\r\n if (typeof els === 'string') {\r\n let doc = document.implementation.createHTMLDocument();\r\n doc.body.innerHTML = els;\r\n el = doc.body.children[0] as HTMLElement;\r\n } else if (arguments.length === 0 || arguments.length === 1 && isGridStackWidget(els)) {\r\n let content = els ? (els as GridStackWidget).content || '' : '';\r\n options = els;\r\n let doc = document.implementation.createHTMLDocument();\r\n doc.body.innerHTML = `
${content}
`;\r\n el = doc.body.children[0] as HTMLElement;\r\n } else {\r\n el = els as HTMLElement;\r\n }\r\n\r\n // Tempting to initialize the passed in opt with default and valid values, but this break knockout demos\r\n // as the actual value are filled in when _prepareElement() calls el.getAttribute('gs-xyz) before adding the node.\r\n // So make sure we load any DOM attributes that are not specified in passed in options (which override)\r\n let domAttr = this._readAttr(el);\r\n options = {...(options || {})}; // make a copy before we modify in case caller re-uses it\r\n Utils.defaults(options, domAttr);\r\n this.engine.prepareNode(options);\r\n this._writeAttr(el, options);\r\n\r\n if (this._insertNotAppend) {\r\n this.el.prepend(el);\r\n } else {\r\n this.el.appendChild(el);\r\n }\r\n\r\n // similar to makeWidget() that doesn't read attr again and worse re-create a new node and loose any _id\r\n this._prepareElement(el, true, options);\r\n this._updateContainerHeight();\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n\r\n return el;\r\n }\r\n\r\n /**\r\n * saves the current layout returning a list of widgets for serialization (with default to save content), which might include any nested grids.\r\n * Optionally you can also save the grid with options itself, so you can call the new GridStack.addGrid()\r\n * to recreate everything from scratch. GridStackOptions.children would then contain the widget list.\r\n */\r\n public save(saveContent = true, saveGridOpt = false): GridStackWidget[] | GridStackOptions {\r\n // return copied nodes we can modify at will...\r\n let list = this.engine.save(saveContent);\r\n\r\n // check for HTML content as well\r\n if (saveContent) {\r\n list.forEach(n => {\r\n if (n.el && !n.subGrid) { // sub-grid are saved differently, not plain content\r\n let sub = n.el.querySelector('.grid-stack-item-content');\r\n n.content = sub ? sub.innerHTML : undefined;\r\n if (!n.content) delete n.content;\r\n delete n.el;\r\n }\r\n });\r\n }\r\n\r\n // check if save entire grid options (needed for recursive) + children...\r\n if (saveGridOpt) {\r\n\r\n // check for nested grid\r\n list.forEach(n => {\r\n if (n.subGrid) {\r\n n.subGrid = (n.subGrid as GridStack).save(saveContent, saveGridOpt) as GridStackOptions;\r\n }\r\n })\r\n\r\n let o: GridStackOptions = {...this.opts};\r\n // delete default values that will be recreated on launch\r\n if (o.marginBottom === o.marginTop && o.marginRight === o.marginLeft && o.marginTop === o.marginRight) {\r\n o.margin = o.marginTop;\r\n delete o.marginTop; delete o.marginRight; delete o.marginBottom; delete o.marginLeft;\r\n }\r\n if (o.rtl === (this.el.style.direction === 'rtl')) { o.rtl = 'auto' }\r\n if (this._isAutoCellHeight) { o.cellHeight = 'auto' }\r\n Utils.removeInternalAndSame(o, GridDefaults);\r\n o.children = list;\r\n return o;\r\n }\r\n\r\n return list;\r\n }\r\n\r\n /**\r\n * load the widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.\r\n *\r\n * @param layout list of widgets definition to update/create\r\n * @param addAndRemove boolean (default true) or callback method can be passed to control if and how missing widgets can be added/removed, giving\r\n * the user control of insertion.\r\n *\r\n * @example\r\n * see http://gridstackjs.com/demo/serialization.html\r\n **/\r\n public load(layout: GridStackWidget[], addAndRemove: boolean | ((g: GridStack, w: GridStackWidget, add: boolean) => GridItemHTMLElement) = true): GridStack {\r\n let items = GridStack.Utils.sort(layout, -1, this._prevColumn || this.opts.column);\r\n this._insertNotAppend = true; // since create in reverse order...\r\n\r\n // if we're loading a layout into 1 column (_prevColumn is set only when going to 1) and items don't fit, make sure to save\r\n // the original wanted layout so we can scale back up correctly #1471\r\n if (this._prevColumn && this._prevColumn !== this.opts.column && items.some(n => (n.x + n.w) > this.opts.column)) {\r\n this._ignoreLayoutsNodeChange = true; // skip layout update\r\n this.engine.cacheLayout(items, this._prevColumn, true);\r\n }\r\n\r\n let removed: GridStackNode[] = [];\r\n this.batchUpdate();\r\n\r\n // see if any items are missing from new layout and need to be removed first\r\n if (addAndRemove) {\r\n let copyNodes = [...this.engine.nodes]; // don't loop through array you modify\r\n copyNodes.forEach(n => {\r\n let item = items.find(w => n.id === w.id);\r\n if (!item) {\r\n if (typeof(addAndRemove) === 'function') {\r\n addAndRemove(this, n, false);\r\n } else {\r\n removed.push(n); // batch keep track\r\n this.removeWidget(n.el, true, false);\r\n }\r\n }\r\n });\r\n }\r\n\r\n // now add/update the widgets\r\n items.forEach(w => {\r\n let item = (w.id || w.id === 0) ? this.engine.nodes.find(n => n.id === w.id) : undefined;\r\n if (item) {\r\n this.update(item.el, w);\r\n if (w.subGrid && (w.subGrid as GridStackOptions).children) { // update any sub grid as well\r\n let sub = item.el.querySelector('.grid-stack') as GridHTMLElement;\r\n if (sub && sub.gridstack) {\r\n sub.gridstack.load((w.subGrid as GridStackOptions).children); // TODO: support updating grid options ?\r\n this._insertNotAppend = true; // got reset by above call\r\n }\r\n }\r\n } else if (addAndRemove) {\r\n if (typeof(addAndRemove) === 'function') {\r\n w = addAndRemove(this, w, true).gridstackNode;\r\n } else {\r\n w = this.addWidget(w).gridstackNode;\r\n }\r\n if (w.subGrid) { // see if there is a sub-grid to create too\r\n let content = w.el.querySelector('.grid-stack-item-content') as HTMLElement;\r\n w.subGrid = GridStack.addGrid(content, w.subGrid as GridStackOptions);\r\n }\r\n }\r\n });\r\n\r\n this.engine.removedNodes = removed;\r\n this.commit();\r\n\r\n // after commit, clear that flag\r\n delete this._ignoreLayoutsNodeChange;\r\n delete this._insertNotAppend;\r\n return this;\r\n }\r\n\r\n /**\r\n * Initializes batch updates. You will see no changes until `commit()` method is called.\r\n */\r\n public batchUpdate(): GridStack {\r\n this.engine.batchUpdate();\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets current cell height.\r\n */\r\n public getCellHeight(forcePixel = false): number {\r\n if (this.opts.cellHeight && this.opts.cellHeight !== 'auto' &&\r\n (!forcePixel || !this.opts.cellHeightUnit || this.opts.cellHeightUnit === 'px')) {\r\n return this.opts.cellHeight as number;\r\n }\r\n // else get first cell height\r\n // or do entire grid and # of rows ? (this.el.getBoundingClientRect().height) / parseInt(this.el.getAttribute('gs-current-row'))\r\n let el = this.el.querySelector('.' + this.opts.itemClass) as HTMLElement;\r\n let height = Utils.toNumber(el.getAttribute('gs-h'));\r\n return Math.round(el.offsetHeight / height);\r\n }\r\n\r\n /**\r\n * Update current cell height - see `GridStackOptions.cellHeight` for format.\r\n * This method rebuilds an internal CSS style sheet.\r\n * Note: You can expect performance issues if call this method too often.\r\n *\r\n * @param val the cell height. If not passed (undefined), cells content will be made square (match width minus margin),\r\n * if pass 0 the CSS will be generated by the application instead.\r\n * @param update (Optional) if false, styles will not be updated\r\n *\r\n * @example\r\n * grid.cellHeight(100); // same as 100px\r\n * grid.cellHeight('70px');\r\n * grid.cellHeight(grid.cellWidth() * 1.2);\r\n */\r\n public cellHeight(val?: numberOrString, update = true): GridStack {\r\n\r\n // if not called internally, check if we're changing mode\r\n if (update && val !== undefined) {\r\n if (this._isAutoCellHeight !== (val === 'auto')) {\r\n this._isAutoCellHeight = (val === 'auto');\r\n this._updateWindowResizeEvent();\r\n }\r\n }\r\n if (val === 'initial' || val === 'auto') { val = undefined; }\r\n\r\n // make item content be square\r\n if (val === undefined) {\r\n let marginDiff = - (this.opts.marginRight as number) - (this.opts.marginLeft as number)\r\n + (this.opts.marginTop as number) + (this.opts.marginBottom as number);\r\n val = this.cellWidth() + marginDiff;\r\n }\r\n\r\n let data = Utils.parseHeight(val);\r\n if (this.opts.cellHeightUnit === data.unit && this.opts.cellHeight === data.h) {\r\n return this;\r\n }\r\n this.opts.cellHeightUnit = data.unit;\r\n this.opts.cellHeight = data.h;\r\n\r\n if (update) {\r\n this._updateStyles(true, this.getRow()); // true = force re-create, for that # of rows\r\n }\r\n return this;\r\n }\r\n\r\n /** Gets current cell width. */\r\n public cellWidth(): number {\r\n return this._widthOrContainer() / this.opts.column;\r\n }\r\n /** return our expected width (or parent) for 1 column check */\r\n private _widthOrContainer(): number {\r\n // use `offsetWidth` or `clientWidth` (no scrollbar) ?\r\n // https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively\r\n return (this.el.clientWidth || this.el.parentElement.clientWidth || window.innerWidth);\r\n }\r\n\r\n /**\r\n * Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.\r\n */\r\n public commit(): GridStack {\r\n this.engine.commit();\r\n this._triggerRemoveEvent();\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n\r\n /** re-layout grid items to reclaim any empty space */\r\n public compact(): GridStack {\r\n this.engine.compact();\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n\r\n /**\r\n * set the number of columns in the grid. Will update existing widgets to conform to new number of columns,\r\n * as well as cache the original layout so you can revert back to previous positions without loss.\r\n * Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11],\r\n * else you will need to generate correct CSS (see https://github.com/gridstack/gridstack.js#change-grid-columns)\r\n * @param column - Integer > 0 (default 12).\r\n * @param layout specify the type of re-layout that will happen (position, size, etc...).\r\n * Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column\r\n */\r\n public column(column: number, layout: ColumnOptions = 'moveScale'): GridStack {\r\n if (this.opts.column === column) return this;\r\n let oldColumn = this.opts.column;\r\n\r\n // if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)\r\n // then remember the original columns so we can restore.\r\n if (column === 1) {\r\n this._prevColumn = oldColumn;\r\n } else {\r\n delete this._prevColumn;\r\n }\r\n\r\n this.el.classList.remove('grid-stack-' + oldColumn);\r\n this.el.classList.add('grid-stack-' + column);\r\n this.opts.column = this.engine.column = column;\r\n\r\n // update the items now - see if the dom order nodes should be passed instead (else default to current list)\r\n let domNodes: GridStackNode[];\r\n if (column === 1 && this.opts.oneColumnModeDomSort) {\r\n domNodes = [];\r\n this.getGridItems().forEach(el => {\r\n if (el.gridstackNode) { domNodes.push(el.gridstackNode); }\r\n });\r\n if (!domNodes.length) { domNodes = undefined; }\r\n }\r\n this.engine.updateNodeWidths(oldColumn, column, domNodes, layout);\r\n\r\n // and trigger our event last...\r\n this._ignoreLayoutsNodeChange = true; // skip layout update\r\n this._triggerChangeEvent();\r\n delete this._ignoreLayoutsNodeChange;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * get the number of columns in the grid (default 12)\r\n */\r\n public getColumn(): number {\r\n return this.opts.column;\r\n }\r\n\r\n /** returns an array of grid HTML elements (no placeholder) - used to iterate through our children */\r\n public getGridItems(): GridItemHTMLElement[] {\r\n return Array.from(this.el.children)\r\n .filter((el: HTMLElement) => el.matches('.' + this.opts.itemClass) && !el.matches('.' + this.opts.placeholderClass)) as GridItemHTMLElement[];\r\n }\r\n\r\n /**\r\n * Destroys a grid instance. DO NOT CALL any methods or access any vars after this as it will free up members.\r\n * @param removeDOM if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`).\r\n */\r\n public destroy(removeDOM = true): GridStack {\r\n if (!this.el) return; // prevent multiple calls\r\n this._updateWindowResizeEvent(true);\r\n this.setStatic(true); // permanently removes DD\r\n if (!removeDOM) {\r\n this.removeAll(removeDOM);\r\n this.el.classList.remove(this.opts._styleSheetClass);\r\n } else {\r\n this.el.parentNode.removeChild(this.el);\r\n }\r\n this._removeStylesheet();\r\n delete this.opts._isNested;\r\n delete this.opts;\r\n delete this._placeholder;\r\n delete this.engine;\r\n delete this.el.gridstack; // remove circular dependency that would prevent a freeing\r\n delete this.el;\r\n return this;\r\n }\r\n\r\n /**\r\n * enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html)\r\n */\r\n public float(val: boolean): GridStack {\r\n this.engine.float = val;\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n\r\n /**\r\n * get the current float mode\r\n */\r\n public getFloat(): boolean {\r\n return this.engine.float;\r\n }\r\n\r\n /**\r\n * Get the position of the cell under a pixel on screen.\r\n * @param position the position of the pixel to resolve in\r\n * absolute coordinates, as an object with top and left properties\r\n * @param useDocRelative if true, value will be based on document position vs parent position (Optional. Default false).\r\n * Useful when grid is within `position: relative` element\r\n *\r\n * Returns an object with properties `x` and `y` i.e. the column and row in the grid.\r\n */\r\n public getCellFromPixel(position: MousePosition, useDocRelative = false): CellPosition {\r\n let box = this.el.getBoundingClientRect();\r\n // console.log(`getBoundingClientRect left: ${box.left} top: ${box.top} w: ${box.w} h: ${box.h}`)\r\n let containerPos;\r\n if (useDocRelative) {\r\n containerPos = {top: box.top + document.documentElement.scrollTop, left: box.left};\r\n // console.log(`getCellFromPixel scrollTop: ${document.documentElement.scrollTop}`)\r\n } else {\r\n containerPos = {top: this.el.offsetTop, left: this.el.offsetLeft}\r\n // console.log(`getCellFromPixel offsetTop: ${containerPos.left} offsetLeft: ${containerPos.top}`)\r\n }\r\n let relativeLeft = position.left - containerPos.left;\r\n let relativeTop = position.top - containerPos.top;\r\n\r\n let columnWidth = (box.width / this.opts.column);\r\n let rowHeight = (box.height / parseInt(this.el.getAttribute('gs-current-row')));\r\n\r\n return {x: Math.floor(relativeLeft / columnWidth), y: Math.floor(relativeTop / rowHeight)};\r\n }\r\n\r\n /** returns the current number of rows, which will be at least `minRow` if set */\r\n public getRow(): number {\r\n return Math.max(this.engine.getRow(), this.opts.minRow);\r\n }\r\n\r\n /**\r\n * Checks if specified area is empty.\r\n * @param x the position x.\r\n * @param y the position y.\r\n * @param w the width of to check\r\n * @param h the height of to check\r\n */\r\n public isAreaEmpty(x: number, y: number, w: number, h: number): boolean {\r\n return this.engine.isAreaEmpty(x, y, w, h);\r\n }\r\n\r\n /**\r\n * If you add elements to your grid by hand, you have to tell gridstack afterwards to make them widgets.\r\n * If you want gridstack to add the elements for you, use `addWidget()` instead.\r\n * Makes the given element a widget and returns it.\r\n * @param els widget or single selector to convert.\r\n *\r\n * @example\r\n * let grid = GridStack.init();\r\n * grid.el.appendChild('
');\r\n * grid.makeWidget('#gsi-1');\r\n */\r\n public makeWidget(els: GridStackElement): GridItemHTMLElement {\r\n let el = GridStack.getElement(els);\r\n this._prepareElement(el, true);\r\n this._updateContainerHeight();\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n return el;\r\n }\r\n\r\n /**\r\n * Event handler that extracts our CustomEvent data out automatically for receiving custom\r\n * notifications (see doc for supported events)\r\n * @param name of the event (see possible values) or list of names space separated\r\n * @param callback function called with event and optional second/third param\r\n * (see README documentation for each signature).\r\n *\r\n * @example\r\n * grid.on('added', function(e, items) { log('added ', items)} );\r\n * or\r\n * grid.on('added removed change', function(e, items) { log(e.type, items)} );\r\n *\r\n * Note: in some cases it is the same as calling native handler and parsing the event.\r\n * grid.el.addEventListener('added', function(event) { log('added ', event.detail)} );\r\n *\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n public on(name: GridStackEvent, callback: (event: Event, arg2?: GridItemHTMLElement | GridStackNode[]) => void): GridStack {\r\n // check for array of names being passed instead\r\n if (name.indexOf(' ') !== -1) {\r\n let names = name.split(' ') as GridStackEvent[];\r\n names.forEach(name => this.on(name, callback));\r\n return this;\r\n }\r\n\r\n if (name === 'change' || name === 'added' || name === 'removed' || name === 'enable' || name === 'disable') {\r\n // native CustomEvent handlers - cash the generic handlers so we can easily remove\r\n let noData = (name === 'enable' || name === 'disable');\r\n if (noData) {\r\n this._gsEventHandler[name] = (event: Event) => callback(event);\r\n } else {\r\n this._gsEventHandler[name] = (event: CustomEvent) => callback(event, event.detail);\r\n }\r\n this.el.addEventListener(name, this._gsEventHandler[name]);\r\n } else if (name === 'dragstart' || name === 'dragstop' || name === 'resizestart' || name === 'resizestop' || name === 'dropped') {\r\n // drag&drop stop events NEED to be call them AFTER we update node attributes so handle them ourself.\r\n // do same for start event to make it easier...\r\n this._gsEventHandler[name] = callback;\r\n } else {\r\n console.log('GridStack.on(' + name + ') event not supported, but you can still use $(\".grid-stack\").on(...) while jquery-ui is still used internally.');\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * unsubscribe from the 'on' event below\r\n * @param name of the event (see possible values)\r\n */\r\n public off(name: GridStackEvent): GridStack {\r\n // check for array of names being passed instead\r\n if (name.indexOf(' ') !== -1) {\r\n let names = name.split(' ') as GridStackEvent[];\r\n names.forEach(name => this.off(name));\r\n return this;\r\n }\r\n\r\n if (name === 'change' || name === 'added' || name === 'removed' || name === 'enable' || name === 'disable') {\r\n // remove native CustomEvent handlers\r\n if (this._gsEventHandler[name]) {\r\n this.el.removeEventListener(name, this._gsEventHandler[name]);\r\n }\r\n }\r\n delete this._gsEventHandler[name];\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes widget from the grid.\r\n * @param el widget or selector to modify\r\n * @param removeDOM if `false` DOM element won't be removed from the tree (Default? true).\r\n * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).\r\n */\r\n public removeWidget(els: GridStackElement, removeDOM = true, triggerEvent = true): GridStack {\r\n GridStack.getElements(els).forEach(el => {\r\n if (el.parentElement !== this.el) return; // not our child!\r\n let node = el.gridstackNode;\r\n // For Meteor support: https://github.com/gridstack/gridstack.js/pull/272\r\n if (!node) {\r\n node = this.engine.nodes.find(n => el === n.el);\r\n }\r\n if (!node) return;\r\n\r\n // remove our DOM data (circular link) and drag&drop permanently\r\n delete el.gridstackNode;\r\n GridStackDDI.get().remove(el);\r\n\r\n this.engine.removeNode(node, removeDOM, triggerEvent);\r\n\r\n if (removeDOM && el.parentElement) {\r\n el.remove(); // in batch mode engine.removeNode doesn't call back to remove DOM\r\n }\r\n });\r\n if (triggerEvent) {\r\n this._triggerRemoveEvent();\r\n this._triggerChangeEvent();\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes all widgets from the grid.\r\n * @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).\r\n */\r\n public removeAll(removeDOM = true): GridStack {\r\n // always remove our DOM data (circular link) before list gets emptied and drag&drop permanently\r\n this.engine.nodes.forEach(n => {\r\n delete n.el.gridstackNode;\r\n GridStackDDI.get().remove(n.el);\r\n });\r\n this.engine.removeAll(removeDOM);\r\n this._triggerRemoveEvent();\r\n return this;\r\n }\r\n\r\n /**\r\n * Toggle the grid animation state. Toggles the `grid-stack-animate` class.\r\n * @param doAnimate if true the grid will animate.\r\n */\r\n public setAnimation(doAnimate: boolean): GridStack {\r\n if (doAnimate) {\r\n this.el.classList.add('grid-stack-animate');\r\n } else {\r\n this.el.classList.remove('grid-stack-animate');\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on.\r\n * Also toggle the grid-stack-static class.\r\n * @param val if true the grid become static.\r\n */\r\n public setStatic(val: boolean): GridStack {\r\n if (this.opts.staticGrid === val) return this;\r\n this.opts.staticGrid = val;\r\n this.engine.nodes.forEach(n => this._prepareDragDropByNode(n)); // either delete Drag&drop or initialize it\r\n this._setStaticClass();\r\n return this;\r\n }\r\n\r\n /**\r\n * Updates widget position/size and other info. Note: if you need to call this on all nodes, use load() instead which will update what changed.\r\n * @param els widget or selector of objects to modify (note: setting the same x,y for multiple items will be indeterministic and likely unwanted)\r\n * @param opt new widget options (x,y,w,h, etc..). Only those set will be updated.\r\n */\r\n public update(els: GridStackElement, opt: GridStackWidget): GridStack {\r\n\r\n // support legacy call for now ?\r\n if (arguments.length > 2) {\r\n console.warn('gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update({x, w, content, ...})`. It will be removed soon');\r\n // eslint-disable-next-line prefer-rest-params\r\n let a = arguments, i = 1;\r\n opt = { x:a[i++], y:a[i++], w:a[i++], h:a[i++] };\r\n return this.update(els, opt);\r\n }\r\n\r\n GridStack.getElements(els).forEach(el => {\r\n if (!el || !el.gridstackNode) return;\r\n let n = el.gridstackNode;\r\n let w = {...opt}; // make a copy we can modify in case they re-use it or multiple items\r\n delete w.autoPosition;\r\n\r\n // move/resize widget if anything changed\r\n let keys = ['x', 'y', 'w', 'h'];\r\n let m: GridStackWidget;\r\n if (keys.some(k => w[k] !== undefined && w[k] !== n[k])) {\r\n m = {};\r\n keys.forEach(k => {\r\n m[k] = (w[k] !== undefined) ? w[k] : n[k];\r\n delete w[k];\r\n });\r\n }\r\n // for a move as well IFF there is any min/max fields set\r\n if (!m && (w.minW || w.minH || w.maxW || w.maxH)) {\r\n m = {}; // will use node position but validate values\r\n }\r\n\r\n // check for content changing\r\n if (w.content) {\r\n let sub = el.querySelector('.grid-stack-item-content');\r\n if (sub && sub.innerHTML !== w.content) {\r\n sub.innerHTML = w.content;\r\n }\r\n delete w.content;\r\n }\r\n\r\n // any remaining fields are assigned, but check for dragging changes, resize constrain\r\n let changed = false;\r\n let ddChanged = false;\r\n for (const key in w) {\r\n if (key[0] !== '_' && n[key] !== w[key]) {\r\n n[key] = w[key];\r\n changed = true;\r\n ddChanged = ddChanged || (!this.opts.staticGrid && (key === 'noResize' || key === 'noMove' || key === 'locked'));\r\n }\r\n }\r\n\r\n // finally move the widget\r\n if (m) {\r\n this.engine.cleanNodes();\r\n this.engine.beginUpdate(n);\r\n this.engine.moveNode(n, m.x, m.y, m.w, m.h);\r\n this._updateContainerHeight();\r\n this._triggerChangeEvent();\r\n this.engine.endUpdate();\r\n }\r\n if (changed) { // move will only update x,y,w,h so update the rest too\r\n this._writeAttr(el, n);\r\n }\r\n if (ddChanged) {\r\n this._prepareDragDropByNode(n);\r\n }\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options (CSS string format of 1,2,4 values or single number).\r\n * @param value margin value\r\n */\r\n public margin(value: numberOrString): GridStack {\r\n let isMultiValue = (typeof value === 'string' && value.split(' ').length > 1);\r\n // check if we can skip re-creating our CSS file... won't check if multi values (too much hassle)\r\n if (!isMultiValue) {\r\n let data = Utils.parseHeight(value);\r\n if (this.opts.marginUnit === data.unit && this.opts.margin === data.h) return;\r\n }\r\n // re-use existing margin handling\r\n this.opts.margin = value;\r\n this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;\r\n this.initMargin();\r\n\r\n this._updateStyles(true); // true = force re-create\r\n\r\n return this;\r\n }\r\n\r\n /** returns current margin number value (undefined if 4 sides don't match) */\r\n public getMargin(): number { return this.opts.margin as number; }\r\n\r\n /**\r\n * Returns true if the height of the grid will be less than the vertical\r\n * constraint. Always returns true if grid doesn't have height constraint.\r\n * @param node contains x,y,w,h,auto-position options\r\n *\r\n * @example\r\n * if (grid.willItFit(newWidget)) {\r\n * grid.addWidget(newWidget);\r\n * } else {\r\n * alert('Not enough free space to place the widget');\r\n * }\r\n */\r\n public willItFit(node: GridStackWidget): boolean {\r\n // support legacy call for now\r\n if (arguments.length > 1) {\r\n console.warn('gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon');\r\n // eslint-disable-next-line prefer-rest-params\r\n let a = arguments, i = 0,\r\n w: GridStackWidget = { x:a[i++], y:a[i++], w:a[i++], h:a[i++], autoPosition:a[i++] };\r\n return this.willItFit(w);\r\n }\r\n return this.engine.willItFit(node);\r\n }\r\n\r\n /** @internal */\r\n private _triggerChangeEvent(): GridStack {\r\n if (this.engine.batchMode) return this;\r\n let elements = this.engine.getDirtyNodes(true); // verify they really changed\r\n if (elements && elements.length) {\r\n if (!this._ignoreLayoutsNodeChange) {\r\n this.engine.layoutsNodesChange(elements);\r\n }\r\n this._triggerEvent('change', elements);\r\n }\r\n this.engine.saveInitial(); // we called, now reset initial values & dirty flags\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n private _triggerAddEvent(): GridStack {\r\n if (this.engine.batchMode) return this;\r\n if (this.engine.addedNodes && this.engine.addedNodes.length > 0) {\r\n if (!this._ignoreLayoutsNodeChange) {\r\n this.engine.layoutsNodesChange(this.engine.addedNodes);\r\n }\r\n // prevent added nodes from also triggering 'change' event (which is called next)\r\n this.engine.addedNodes.forEach(n => { delete n._dirty; });\r\n this._triggerEvent('added', this.engine.addedNodes);\r\n this.engine.addedNodes = [];\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n public _triggerRemoveEvent(): GridStack {\r\n if (this.engine.batchMode) return this;\r\n if (this.engine.removedNodes && this.engine.removedNodes.length > 0) {\r\n this._triggerEvent('removed', this.engine.removedNodes);\r\n this.engine.removedNodes = [];\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n private _triggerEvent(name: string, data?: GridStackNode[]): GridStack {\r\n let event = data ? new CustomEvent(name, {bubbles: false, detail: data}) : new Event(name);\r\n this.el.dispatchEvent(event);\r\n return this;\r\n }\r\n\r\n /** @internal called to delete the current dynamic style sheet used for our layout */\r\n private _removeStylesheet(): GridStack {\r\n\r\n if (this._styles) {\r\n Utils.removeStylesheet(this._styles._id);\r\n delete this._styles;\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal updated/create the CSS styles for row based layout and initial margin setting */\r\n private _updateStyles(forceUpdate = false, maxH?: number): GridStack {\r\n // call to delete existing one if we change cellHeight / margin\r\n if (forceUpdate) {\r\n this._removeStylesheet();\r\n }\r\n\r\n this._updateContainerHeight();\r\n\r\n // if user is telling us they will handle the CSS themselves by setting heights to 0. Do we need this opts really ??\r\n if (this.opts.cellHeight === 0) {\r\n return this;\r\n }\r\n\r\n let cellHeight = this.opts.cellHeight as number;\r\n let cellHeightUnit = this.opts.cellHeightUnit;\r\n let prefix = `.${this.opts._styleSheetClass} > .${this.opts.itemClass}`;\r\n\r\n // create one as needed\r\n if (!this._styles) {\r\n let id = 'gridstack-style-' + (Math.random() * 100000).toFixed();\r\n // insert style to parent (instead of 'head' by default) to support WebComponent\r\n let styleLocation = this.opts.styleInHead ? undefined : this.el.parentNode as HTMLElement;\r\n this._styles = Utils.createStylesheet(id, styleLocation);\r\n if (!this._styles) return this;\r\n this._styles._id = id;\r\n this._styles._max = 0;\r\n\r\n // these are done once only\r\n Utils.addCSSRule(this._styles, prefix, `min-height: ${cellHeight}${cellHeightUnit}`);\r\n // content margins\r\n let top: string = this.opts.marginTop + this.opts.marginUnit;\r\n let bottom: string = this.opts.marginBottom + this.opts.marginUnit;\r\n let right: string = this.opts.marginRight + this.opts.marginUnit;\r\n let left: string = this.opts.marginLeft + this.opts.marginUnit;\r\n let content = `${prefix} > .grid-stack-item-content`;\r\n let placeholder = `.${this.opts._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;\r\n Utils.addCSSRule(this._styles, content, `top: ${top}; right: ${right}; bottom: ${bottom}; left: ${left};`);\r\n Utils.addCSSRule(this._styles, placeholder, `top: ${top}; right: ${right}; bottom: ${bottom}; left: ${left};`);\r\n // resize handles offset (to match margin)\r\n Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-ne`, `right: ${right}`);\r\n Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-e`, `right: ${right}`);\r\n Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-se`, `right: ${right}; bottom: ${bottom}`);\r\n Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-nw`, `left: ${left}`);\r\n Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-w`, `left: ${left}`);\r\n Utils.addCSSRule(this._styles, `${prefix} > .ui-resizable-sw`, `left: ${left}; bottom: ${bottom}`);\r\n }\r\n\r\n // now update the height specific fields\r\n maxH = maxH || this._styles._max;\r\n if (maxH > this._styles._max) {\r\n let getHeight = (rows: number): string => (cellHeight * rows) + cellHeightUnit;\r\n for (let i = this._styles._max + 1; i <= maxH; i++) { // start at 1\r\n let h: string = getHeight(i);\r\n Utils.addCSSRule(this._styles, `${prefix}[gs-y=\"${i-1}\"]`, `top: ${getHeight(i-1)}`); // start at 0\r\n Utils.addCSSRule(this._styles, `${prefix}[gs-h=\"${i}\"]`, `height: ${h}`);\r\n Utils.addCSSRule(this._styles, `${prefix}[gs-min-h=\"${i}\"]`, `min-height: ${h}`);\r\n Utils.addCSSRule(this._styles, `${prefix}[gs-max-h=\"${i}\"]`, `max-height: ${h}`);\r\n }\r\n this._styles._max = maxH;\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n private _updateContainerHeight(): GridStack {\r\n if (!this.engine || this.engine.batchMode) return this;\r\n let row = this.getRow(); // checks for minRow already\r\n // check for css min height\r\n let cssMinHeight = parseInt(getComputedStyle(this.el)['min-height']);\r\n if (cssMinHeight > 0) {\r\n let minRow = Math.round(cssMinHeight / this.getCellHeight(true));\r\n if (row < minRow) {\r\n row = minRow;\r\n }\r\n }\r\n this.el.setAttribute('gs-current-row', String(row));\r\n if (row === 0) {\r\n this.el.style.removeProperty('height');\r\n return this;\r\n }\r\n let cellHeight = this.opts.cellHeight as number;\r\n let unit = this.opts.cellHeightUnit;\r\n if (!cellHeight) return this;\r\n this.el.style.height = row * cellHeight + unit;\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n private _prepareElement(el: GridItemHTMLElement, triggerAddEvent = false, node?: GridStackNode): GridStack {\r\n if (!node) {\r\n el.classList.add(this.opts.itemClass);\r\n node = this._readAttr(el);\r\n }\r\n el.gridstackNode = node;\r\n node.el = el;\r\n node.grid = this;\r\n let copy = {...node};\r\n node = this.engine.addNode(node, triggerAddEvent);\r\n // write node attr back in case there was collision or we have to fix bad values during addNode()\r\n if (!Utils.same(node, copy)) {\r\n this._writeAttr(el, node);\r\n }\r\n this._prepareDragDropByNode(node);\r\n return this;\r\n }\r\n\r\n /** @internal call to write x,y,w,h attributes back to element */\r\n private _writePosAttr(el: HTMLElement, x?: number, y?: number, w?: number, h?: number): GridStack {\r\n if (x !== undefined && x !== null) { el.setAttribute('gs-x', String(x)); }\r\n if (y !== undefined && y !== null) { el.setAttribute('gs-y', String(y)); }\r\n if (w) { el.setAttribute('gs-w', String(w)); }\r\n if (h) { el.setAttribute('gs-h', String(h)); }\r\n return this;\r\n }\r\n\r\n /** @internal call to write any default attributes back to element */\r\n private _writeAttr(el: HTMLElement, node: GridStackWidget): GridStack {\r\n if (!node) return this;\r\n this._writePosAttr(el, node.x, node.y, node.w, node.h);\r\n\r\n let attrs /*: GridStackWidget but strings */ = { // remaining attributes\r\n autoPosition: 'gs-auto-position',\r\n minW: 'gs-min-w',\r\n minH: 'gs-min-h',\r\n maxW: 'gs-max-w',\r\n maxH: 'gs-max-h',\r\n noResize: 'gs-no-resize',\r\n noMove: 'gs-no-move',\r\n locked: 'gs-locked',\r\n id: 'gs-id',\r\n resizeHandles: 'gs-resize-handles'\r\n };\r\n for (const key in attrs) {\r\n if (node[key]) { // 0 is valid for x,y only but done above already and not in list anyway\r\n el.setAttribute(attrs[key], String(node[key]));\r\n } else {\r\n el.removeAttribute(attrs[key]);\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n /** @internal call to read any default attributes from element */\r\n private _readAttr(el: HTMLElement): GridStackWidget {\r\n let node: GridStackNode = {};\r\n node.x = Utils.toNumber(el.getAttribute('gs-x'));\r\n node.y = Utils.toNumber(el.getAttribute('gs-y'));\r\n node.w = Utils.toNumber(el.getAttribute('gs-w'));\r\n node.h = Utils.toNumber(el.getAttribute('gs-h'));\r\n node.maxW = Utils.toNumber(el.getAttribute('gs-max-w'));\r\n node.minW = Utils.toNumber(el.getAttribute('gs-min-w'));\r\n node.maxH = Utils.toNumber(el.getAttribute('gs-max-h'));\r\n node.minH = Utils.toNumber(el.getAttribute('gs-min-h'));\r\n node.autoPosition = Utils.toBool(el.getAttribute('gs-auto-position'));\r\n node.noResize = Utils.toBool(el.getAttribute('gs-no-resize'));\r\n node.noMove = Utils.toBool(el.getAttribute('gs-no-move'));\r\n node.locked = Utils.toBool(el.getAttribute('gs-locked'));\r\n node.resizeHandles = el.getAttribute('gs-resize-handles');\r\n node.id = el.getAttribute('gs-id');\r\n\r\n // remove any key not found (null or false which is default)\r\n for (const key in node) {\r\n if (!node.hasOwnProperty(key)) return;\r\n if (!node[key] && node[key] !== 0) { // 0 can be valid value (x,y only really)\r\n delete node[key];\r\n }\r\n }\r\n\r\n return node;\r\n }\r\n\r\n /** @internal */\r\n private _setStaticClass(): GridStack {\r\n let classes = ['grid-stack-static'];\r\n\r\n if (this.opts.staticGrid) {\r\n this.el.classList.add(...classes);\r\n this.el.setAttribute('gs-static', 'true');\r\n } else {\r\n this.el.classList.remove(...classes);\r\n this.el.removeAttribute('gs-static');\r\n\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * called when we are being resized by the window - check if the one Column Mode needs to be turned on/off\r\n * and remember the prev columns we used, as well as check for auto cell height (square)\r\n */\r\n public onParentResize(): GridStack {\r\n if (!this.el || !this.el.clientWidth) return; // return if we're gone or no size yet (will get called again)\r\n let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.minWidth;\r\n let changedOneColumn = false;\r\n\r\n if (!this._oneColumnMode !== !oneColumn) { // use ! (negate) so we can check undefined == false vs true\r\n this._oneColumnMode = oneColumn;\r\n changedOneColumn = true;\r\n if (this.opts.animate) { this.setAnimation(false); } // 1 <-> 12 is too radical, turn off animation\r\n this.column(oneColumn ? 1 : this._prevColumn);\r\n if (this.opts.animate) { this.setAnimation(true); }\r\n }\r\n\r\n // make the cells content square again\r\n if (this._isAutoCellHeight) {\r\n if (!changedOneColumn && this.opts.cellHeightThrottle) {\r\n if (!this._cellHeightThrottle) {\r\n this._cellHeightThrottle = Utils.throttle(() => this.cellHeight(), this.opts.cellHeightThrottle);\r\n }\r\n this._cellHeightThrottle();\r\n } else {\r\n // immediate update if we've changed to/from oneColumn or have no threshold\r\n this.cellHeight();\r\n }\r\n }\r\n\r\n // finally update any nested grids\r\n this.engine.nodes.forEach(n => {\r\n if (n.subGrid) {(n.subGrid as GridStack).onParentResize()}\r\n });\r\n\r\n return this;\r\n }\r\n\r\n /** add or remove the window size event handler */\r\n private _updateWindowResizeEvent(forceRemove = false): GridStack {\r\n // only add event if we're not nested (parent will call us) and we're auto sizing cells or supporting oneColumn (i.e. doing work)\r\n const workTodo = (this._isAutoCellHeight || !this.opts.disableOneColumnMode) && !this.opts._isNested;\r\n\r\n if (!forceRemove && workTodo && !this._windowResizeBind) {\r\n this._windowResizeBind = this.onParentResize.bind(this); // so we can properly remove later\r\n window.addEventListener('resize', this._windowResizeBind);\r\n } else if ((forceRemove || !workTodo) && this._windowResizeBind) {\r\n window.removeEventListener('resize', this._windowResizeBind);\r\n delete this._windowResizeBind; // remove link to us so we can free\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** @internal convert a potential selector into actual element */\r\n public static getElement(els: GridStackElement = '.grid-stack-item'): GridItemHTMLElement { return Utils.getElement(els) }\r\n /** @internal */\r\n public static getElements(els: GridStackElement = '.grid-stack-item'): GridItemHTMLElement[] { return Utils.getElements(els) }\r\n /** @internal */\r\n public static getGridElement(els: GridStackElement): GridHTMLElement { return GridStack.getElement(els) }\r\n /** @internal */\r\n public static getGridElements(els: string): GridHTMLElement[] { return Utils.getElements(els) }\r\n\r\n /** @internal initialize margin top/bottom/left/right and units */\r\n private initMargin(): GridStack {\r\n\r\n let data: HeightData;\r\n let margin = 0;\r\n\r\n // support passing multiple values like CSS (ex: '5px 10px 0 20px')\r\n let margins: string[] = [];\r\n if (typeof this.opts.margin === 'string') {\r\n margins = this.opts.margin.split(' ')\r\n }\r\n if (margins.length === 2) { // top/bot, left/right like CSS\r\n this.opts.marginTop = this.opts.marginBottom = margins[0];\r\n this.opts.marginLeft = this.opts.marginRight = margins[1];\r\n } else if (margins.length === 4) { // Clockwise like CSS\r\n this.opts.marginTop = margins[0];\r\n this.opts.marginRight = margins[1];\r\n this.opts.marginBottom = margins[2];\r\n this.opts.marginLeft = margins[3];\r\n } else {\r\n data = Utils.parseHeight(this.opts.margin);\r\n this.opts.marginUnit = data.unit;\r\n margin = this.opts.margin = data.h;\r\n }\r\n\r\n // see if top/bottom/left/right need to be set as well\r\n if (this.opts.marginTop === undefined) {\r\n this.opts.marginTop = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginTop);\r\n this.opts.marginTop = data.h;\r\n delete this.opts.margin;\r\n }\r\n\r\n if (this.opts.marginBottom === undefined) {\r\n this.opts.marginBottom = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginBottom);\r\n this.opts.marginBottom = data.h;\r\n delete this.opts.margin;\r\n }\r\n\r\n if (this.opts.marginRight === undefined) {\r\n this.opts.marginRight = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginRight);\r\n this.opts.marginRight = data.h;\r\n delete this.opts.margin;\r\n }\r\n\r\n if (this.opts.marginLeft === undefined) {\r\n this.opts.marginLeft = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginLeft);\r\n this.opts.marginLeft = data.h;\r\n delete this.opts.margin;\r\n }\r\n this.opts.marginUnit = data.unit; // in case side were spelled out, use those units instead...\r\n if (this.opts.marginTop === this.opts.marginBottom && this.opts.marginLeft === this.opts.marginRight && this.opts.marginTop === this.opts.marginRight) {\r\n this.opts.margin = this.opts.marginTop; // makes it easier to check for no-ops in setMargin()\r\n }\r\n return this;\r\n }\r\n\r\n /*\r\n * drag&drop empty stubs that will be implemented in gridstack-dd.ts for non static grid\r\n * so we don't incur the load unless needed.\r\n * NOTE: had to make those methods public in order to define them else as\r\n * GridStack.prototype._setupAcceptWidget = function()\r\n * maybe there is a better way ????\r\n */\r\n /* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n /**\r\n * Enables/Disables moving. No-op for static grids.\r\n * @param els widget or selector to modify.\r\n * @param val if true widget will be draggable.\r\n */\r\n public movable(els: GridStackElement, val: boolean): GridStack { return this }\r\n /**\r\n * Enables/Disables resizing. No-op for static grids.\r\n * @param els widget or selector to modify\r\n * @param val if true widget will be resizable.\r\n */\r\n public resizable(els: GridStackElement, val: boolean): GridStack { return this }\r\n /**\r\n * Temporarily disables widgets moving/resizing.\r\n * If you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.\r\n * Note: no-op for static grid\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(false);\r\n * grid.enableResize(false);\r\n */\r\n public disable(): GridStack { return this }\r\n /**\r\n * Re-enables widgets moving/resizing - see disable().\r\n * Note: no-op for static grid.\r\n * This is a shortcut for:\r\n * @example\r\n * grid.enableMove(true);\r\n * grid.enableResize(true);\r\n */\r\n public enable(): GridStack { return this }\r\n /**\r\n * Enables/disables widget moving. No-op for static grids.\r\n *\r\n * @param doEnable\r\n * @param includeNewWidgets will force new widgets to be draggable as per\r\n * doEnable`s value by changing the disableDrag grid option (default: true).\r\n */\r\n public enableMove(doEnable: boolean, includeNewWidgets = true): GridStack { return this }\r\n /**\r\n * Enables/disables widget resizing. No-op for static grids.\r\n * @param doEnable\r\n * @param includeNewWidgets will force new widgets to be draggable as per\r\n * doEnable`s value by changing the disableResize grid option (default: true).\r\n */\r\n public enableResize(doEnable: boolean, includeNewWidgets = true): GridStack { return this }\r\n /** @internal called to add drag over support to support widgets */\r\n public _setupAcceptWidget(): GridStack { return this }\r\n /** @internal called to setup a trash drop zone if the user specifies it */\r\n public _setupRemoveDrop(): GridStack { return this }\r\n /** @internal */\r\n public _setupRemovingTimeout(el: GridItemHTMLElement): GridStack { return this }\r\n /** @internal */\r\n public _clearRemovingTimeout(el: GridItemHTMLElement): GridStack { return this }\r\n /** @internal call to setup dragging in from the outside (say toolbar), with options */\r\n public _setupDragIn(): GridStack { return this }\r\n /** @internal prepares the element for drag&drop **/\r\n public _prepareDragDropByNode(node: GridStackNode): GridStack { return this }\r\n\r\n // 2.x API that just calls the new and better update() - keep those around for backward compat only...\r\n /** @internal */\r\n public locked(els: GridStackElement, locked: boolean): GridStack { return this.update(els, {locked}) }\r\n /** @internal */\r\n public maxWidth(els: GridStackElement, maxW: number): GridStack { return this.update(els, {maxW}) }\r\n /** @internal */\r\n public minWidth(els: GridStackElement, minW: number): GridStack { return this.update(els, {minW}) }\r\n /** @internal */\r\n public maxHeight(els: GridStackElement, maxH: number): GridStack { return this.update(els, {maxH}) }\r\n /** @internal */\r\n public minHeight(els: GridStackElement, minH: number): GridStack { return this.update(els, {minH}) }\r\n /** @internal */\r\n public move(els: GridStackElement, x?: number, y?: number): GridStack { return this.update(els, {x, y}) }\r\n /** @internal */\r\n public resize(els: GridStackElement, w?: number, h?: number): GridStack { return this.update(els, {w, h}) }\r\n}\r\n","// dd-base-impl.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nexport type EventCallback = (event: Event) => boolean|void;\nexport abstract class DDBaseImplement {\n /** returns the enable state, but you have to call enable()/disable() to change (as other things need to happen) */\n public get disabled(): boolean { return this._disabled; }\n\n /** @internal */\n private _disabled = false;\n /** @internal */\n private _eventRegister: {\n [eventName: string]: EventCallback;\n } = {};\n\n public on(event: string, callback: EventCallback): void {\n this._eventRegister[event] = callback;\n }\n\n public off(event: string): void {\n delete this._eventRegister[event];\n }\n\n public enable(): void {\n this._disabled = false;\n }\n\n public disable(): void {\n this._disabled = true;\n }\n\n public destroy(): void {\n delete this._eventRegister;\n }\n\n public triggerEvent(eventName: string, event: Event): boolean|void {\n if (this.disabled) return;\n if (!this._eventRegister) {return; } // used when destroy before triggerEvent fire\n if (this._eventRegister[eventName]) {\n return this._eventRegister[eventName](event);\n }\n }\n}\n\nexport interface HTMLElementExtendOpt {\n el: HTMLElement;\n option: T;\n updateOption(T): DDBaseImplement;\n}\n","// dd-draggable.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nimport { DDManager } from './dd-manager';\nimport { DDUtils } from './dd-utils';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { GridItemHTMLElement, DDUIData } from '../types';\n\n// TODO: merge with DDDragOpt ?\nexport interface DDDraggableOpt {\n appendTo?: string | HTMLElement;\n containment?: string | HTMLElement; // TODO: not implemented yet\n handle?: string;\n revert?: string | boolean | unknown; // TODO: not implemented yet\n scroll?: boolean; // nature support by HTML5 drag drop, can't be switch to off actually\n helper?: string | HTMLElement | ((event: Event) => HTMLElement);\n basePosition?: 'fixed' | 'absolute';\n start?: (event: Event, ui: DDUIData) => void;\n stop?: (event: Event) => void;\n drag?: (event: Event, ui: DDUIData) => void;\n}\n\ninterface DragOffset {\n left: number;\n top: number;\n width: number;\n height: number;\n offsetLeft: number;\n offsetTop: number;\n}\n\nexport class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt {\n public el: HTMLElement;\n public option: DDDraggableOpt;\n public helper: HTMLElement; // used by GridStackDDNative\n\n /** @internal */\n private dragOffset: DragOffset;\n /** @internal */\n private dragElementOriginStyle: Array;\n /** @internal */\n private dragFollowTimer: number;\n /** @internal */\n private dragEl: HTMLElement;\n /** @internal */\n private dragging = false;\n /** @internal */\n private paintTimer: number;\n /** @internal */\n private parentOriginStylePosition: string;\n /** @internal */\n private helperContainment: HTMLElement;\n /** @internal */\n private static basePosition: 'fixed' | 'absolute' = 'absolute';\n /** @internal #1541 can't have {passive: true} on Safari as otherwise it reverts animate back to old location on drop */\n private static dragEventListenerOption = true; // DDUtils.isEventSupportPassiveOption ? { capture: true, passive: true } : true;\n /** @internal */\n private static originStyleProp = ['transition', 'pointerEvents', 'position',\n 'left', 'top', 'opacity', 'zIndex', 'width', 'height', 'willChange'];\n\n constructor(el: HTMLElement, option: DDDraggableOpt = {}) {\n super();\n this.el = el;\n this.option = option;\n // get the element that is actually supposed to be dragged by\n let className = option.handle.substring(1);\n this.dragEl = el.classList.contains(className) ? el : el.querySelector(option.handle) || el;\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n this._dragStart = this._dragStart.bind(this);\n this._drag = this._drag.bind(this);\n this._dragEnd = this._dragEnd.bind(this);\n this._dragFollow = this._dragFollow.bind(this);\n this.enable();\n }\n\n public on(event: 'drag' | 'dragstart' | 'dragstop', callback: (event: DragEvent) => void): void {\n super.on(event, callback);\n }\n\n public off(event: 'drag' | 'dragstart' | 'dragstop'): void {\n super.off(event);\n }\n\n public enable(): void {\n super.enable();\n this.dragEl.draggable = true;\n this.dragEl.addEventListener('dragstart', this._dragStart);\n this.el.classList.remove('ui-draggable-disabled');\n this.el.classList.add('ui-draggable');\n }\n\n public disable(forDestroy = false): void {\n super.disable();\n this.dragEl.removeAttribute('draggable');\n this.dragEl.removeEventListener('dragstart', this._dragStart);\n this.el.classList.remove('ui-draggable');\n if (!forDestroy) this.el.classList.add('ui-draggable-disabled');\n }\n\n public destroy(): void {\n if (this.dragging) {\n // Destroy while dragging should remove dragend listener and manually trigger\n // dragend, otherwise dragEnd can't perform dragstop because eventRegistry is\n // destroyed.\n this._dragEnd({} as DragEvent);\n }\n this.disable(true);\n delete this.el;\n delete this.helper;\n delete this.option;\n super.destroy();\n }\n\n public updateOption(opts: DDDraggableOpt): DDDraggable {\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n return this;\n }\n\n /** @internal */\n private _dragStart(event: DragEvent): void {\n DDManager.dragElement = this;\n this.helper = this._createHelper(event);\n this._setupHelperContainmentStyle();\n this.dragOffset = this._getDragOffset(event, this.el, this.helperContainment);\n const ev = DDUtils.initEvent(event, { target: this.el, type: 'dragstart' });\n if (this.helper !== this.el) {\n this._setupDragFollowNodeNotifyStart(ev);\n } else {\n this.dragFollowTimer = window.setTimeout(() => {\n delete this.dragFollowTimer;\n this._setupDragFollowNodeNotifyStart(ev);\n }, 0);\n }\n this._cancelDragGhost(event);\n }\n\n /** @internal */\n private _setupDragFollowNodeNotifyStart(ev: Event): DDDraggable {\n this._setupHelperStyle();\n document.addEventListener('dragover', this._drag, DDDraggable.dragEventListenerOption);\n this.dragEl.addEventListener('dragend', this._dragEnd);\n if (this.option.start) {\n this.option.start(ev, this.ui());\n }\n this.dragging = true;\n this.helper.classList.add('ui-draggable-dragging');\n this.triggerEvent('dragstart', ev);\n return this;\n }\n\n /** @internal */\n private _drag(event: DragEvent): void {\n // Safari: prevent default to allow drop to happen instead of reverting back (with animation) and delaying dragend #1541\n // https://stackoverflow.com/questions/61760755/how-to-fire-dragend-event-immediately\n event.preventDefault();\n this._dragFollow(event);\n const ev = DDUtils.initEvent(event, { target: this.el, type: 'drag' });\n if (this.option.drag) {\n this.option.drag(ev, this.ui());\n }\n this.triggerEvent('drag', ev);\n }\n\n /** @internal */\n private _dragEnd(event: DragEvent): void {\n if (this.dragFollowTimer) {\n clearTimeout(this.dragFollowTimer);\n delete this.dragFollowTimer;\n return;\n } else {\n if (this.paintTimer) {\n cancelAnimationFrame(this.paintTimer);\n }\n document.removeEventListener('dragover', this._drag, DDDraggable.dragEventListenerOption);\n this.dragEl.removeEventListener('dragend', this._dragEnd);\n }\n this.dragging = false;\n this.helper.classList.remove('ui-draggable-dragging');\n this.helperContainment.style.position = this.parentOriginStylePosition || null;\n if (this.helper === this.el) {\n this._removeHelperStyle();\n } else {\n this.helper.remove();\n }\n const ev = DDUtils.initEvent(event, { target: this.el, type: 'dragstop' });\n if (this.option.stop) {\n this.option.stop(ev); // Note: ui() not used by gridstack so don't pass\n }\n this.triggerEvent('dragstop', ev);\n delete DDManager.dragElement;\n delete this.helper;\n }\n\n /** @internal create a clone copy (or user defined method) of the original drag item if set */\n private _createHelper(event: DragEvent): HTMLElement {\n let helper = this.el;\n if (typeof this.option.helper === 'function') {\n helper = this.option.helper.apply(this.el, event);\n } else if (this.option.helper === 'clone') {\n helper = DDUtils.clone(this.el);\n }\n if (!document.body.contains(helper)) {\n DDUtils.appendTo(helper, this.option.appendTo === 'parent' ? this.el.parentNode : this.option.appendTo);\n }\n if (helper === this.el) {\n this.dragElementOriginStyle = DDDraggable.originStyleProp.map(prop => this.el.style[prop]);\n }\n return helper;\n }\n\n /** @internal */\n private _setupHelperStyle(): DDDraggable {\n this.helper.style.pointerEvents = 'none';\n this.helper.style.width = this.dragOffset.width + 'px';\n this.helper.style.height = this.dragOffset.height + 'px';\n this.helper.style.willChange = 'left, top';\n this.helper.style.transition = 'none'; // show up instantly\n this.helper.style.position = this.option.basePosition || DDDraggable.basePosition;\n this.helper.style.zIndex = '1000';\n setTimeout(() => {\n if (this.helper) {\n this.helper.style.transition = null; // recover animation\n }\n }, 0);\n return this;\n }\n\n /** @internal */\n private _removeHelperStyle(): DDDraggable {\n // don't bother restoring styles if we're gonna remove anyway...\n let node = this.helper ? (this.helper as GridItemHTMLElement).gridstackNode : undefined;\n if (!node || !node._isAboutToRemove) {\n DDDraggable.originStyleProp.forEach(prop => {\n this.helper.style[prop] = this.dragElementOriginStyle[prop] || null;\n });\n }\n delete this.dragElementOriginStyle;\n return this;\n }\n\n /** @internal */\n private _dragFollow(event: DragEvent): void {\n if (this.paintTimer) {\n cancelAnimationFrame(this.paintTimer);\n }\n this.paintTimer = requestAnimationFrame(() => {\n delete this.paintTimer;\n const offset = this.dragOffset;\n let containmentRect = { left: 0, top: 0 };\n if (this.helper.style.position === 'absolute') {\n const { left, top } = this.helperContainment.getBoundingClientRect();\n containmentRect = { left, top };\n }\n this.helper.style.left = event.clientX + offset.offsetLeft - containmentRect.left + 'px';\n this.helper.style.top = event.clientY + offset.offsetTop - containmentRect.top + 'px';\n });\n }\n\n /** @internal */\n private _setupHelperContainmentStyle(): DDDraggable {\n this.helperContainment = this.helper.parentElement;\n if (this.option.basePosition !== 'fixed') {\n this.parentOriginStylePosition = this.helperContainment.style.position;\n if (window.getComputedStyle(this.helperContainment).position.match(/static/)) {\n this.helperContainment.style.position = 'relative';\n }\n }\n return this;\n }\n\n /** @internal prevent the default gost image to be created (which has wrongas we move the helper/element instead\n * (legacy jquery UI code updates the top/left of the item).\n * TODO: maybe use mouse event instead of HTML5 drag as we have to work around it anyway, or change code to not update\n * the actual grid-item but move the gost image around (and special case jq version) ?\n **/\n private _cancelDragGhost(e: DragEvent): DDDraggable {\n /* doesn't seem to do anything...\n let t = e.dataTransfer;\n t.effectAllowed = 'none';\n t.dropEffect = 'none';\n t.setData('text', '');\n */\n\n // NOTE: according to spec (and required by Safari see #1540) the image has to be visible in the browser (in dom and not hidden) so make it a 1px div\n let img = document.createElement('div');\n img.style.width = '1px';\n img.style.height = '1px';\n document.body.appendChild(img);\n e.dataTransfer.setDragImage(img, 0, 0);\n setTimeout(() => document.body.removeChild(img)); // nuke once drag had a chance to grab this 'image'\n\n e.stopPropagation();\n return this;\n }\n\n /** @internal */\n private _getDragOffset(event: DragEvent, el: HTMLElement, parent: HTMLElement): DragOffset {\n\n // in case ancestor has transform/perspective css properties that change the viewpoint\n let xformOffsetX = 0;\n let xformOffsetY = 0;\n if (parent) {\n const testEl = document.createElement('div');\n DDUtils.addElStyles(testEl, {\n opacity: '0',\n position: 'fixed',\n top: 0 + 'px',\n left: 0 + 'px',\n width: '1px',\n height: '1px',\n zIndex: '-999999',\n });\n parent.appendChild(testEl);\n const testElPosition = testEl.getBoundingClientRect();\n parent.removeChild(testEl);\n xformOffsetX = testElPosition.left;\n xformOffsetY = testElPosition.top;\n // TODO: scale ?\n }\n\n const targetOffset = el.getBoundingClientRect();\n return {\n left: targetOffset.left,\n top: targetOffset.top,\n offsetLeft: - event.clientX + targetOffset.left - xformOffsetX,\n offsetTop: - event.clientY + targetOffset.top - xformOffsetY,\n width: targetOffset.width,\n height: targetOffset.height\n };\n }\n\n /** @internal TODO: set to public as called by DDDroppable! */\n public ui = (): DDUIData => {\n const containmentEl = this.el.parentElement;\n const containmentRect = containmentEl.getBoundingClientRect();\n const offset = this.helper.getBoundingClientRect();\n return {\n position: { //Current CSS position of the helper as { top, left } object\n top: offset.top - containmentRect.top,\n left: offset.left - containmentRect.left\n }\n /* not used by GridStack for now...\n helper: [this.helper], //The object arr representing the helper that's being dragged.\n offset: { top: offset.top, left: offset.left } // Current offset position of the helper as { top, left } object.\n */\n };\n }\n}\n\n\n","// dd-droppable.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nimport { DDDraggable } from './dd-draggable';\nimport { DDManager } from './dd-manager';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { DDUtils } from './dd-utils';\n\nexport interface DDDroppableOpt {\n accept?: string | ((el: HTMLElement) => boolean);\n drop?: (event: DragEvent, ui) => void;\n over?: (event: DragEvent, ui) => void;\n out?: (event: DragEvent, ui) => void;\n}\n\nexport class DDDroppable extends DDBaseImplement implements HTMLElementExtendOpt {\n\n public accept: (el: HTMLElement) => boolean;\n public el: HTMLElement;\n public option: DDDroppableOpt;\n\n /** @internal */\n private moving: boolean;\n\n constructor(el: HTMLElement, opts: DDDroppableOpt = {}) {\n super();\n this.el = el;\n this.option = opts;\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n this._dragEnter = this._dragEnter.bind(this);\n this._dragOver = this._dragOver.bind(this);\n this._dragLeave = this._dragLeave.bind(this);\n this._drop = this._drop.bind(this);\n\n this.el.classList.add('ui-droppable');\n this.el.addEventListener('dragenter', this._dragEnter);\n this._setupAccept();\n }\n\n public on(event: 'drop' | 'dropover' | 'dropout', callback: (event: DragEvent) => void): void {\n super.on(event, callback);\n }\n\n public off(event: 'drop' | 'dropover' | 'dropout'): void {\n super.off(event);\n }\n\n public enable(): void {\n if (!this.disabled) return;\n super.enable();\n this.el.classList.remove('ui-droppable-disabled');\n this.el.addEventListener('dragenter', this._dragEnter);\n }\n\n public disable(forDestroy=false): void {\n if (this.disabled) return;\n super.disable();\n if (!forDestroy) this.el.classList.add('ui-droppable-disabled');\n this.el.removeEventListener('dragenter', this._dragEnter);\n }\n\n public destroy(): void {\n if (this.moving) {\n this._removeLeaveCallbacks();\n } \n this.disable(true);\n this.el.classList.remove('ui-droppable');\n this.el.classList.remove('ui-droppable-disabled');\n delete this.moving;\n super.destroy();\n }\n\n public updateOption(opts: DDDroppableOpt): DDDroppable {\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n this._setupAccept();\n return this;\n }\n\n /** @internal called when the cursor enters our area - prepare for a possible drop and track leaving */\n private _dragEnter(event: DragEvent): void {\n if (!this._canDrop()) return;\n this.moving = true;\n\n event.preventDefault();\n const ev = DDUtils.initEvent(event, { target: this.el, type: 'dropover' });\n if (this.option.over) {\n this.option.over(ev, this._ui(DDManager.dragElement))\n }\n this.triggerEvent('dropover', ev);\n this.el.addEventListener('dragover', this._dragOver);\n this.el.addEventListener('drop', this._drop);\n this.el.addEventListener('dragleave', this._dragLeave);\n this.el.classList.add('ui-droppable-over');\n }\n\n /** @internal called when an moving to drop item is being dragged over - do nothing but eat the event */\n private _dragOver(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n }\n\n /** @internal called when the item is leaving our area, stop tracking if we had moving item */\n private _dragLeave(event: DragEvent): void {\n if (this.el.contains(event.relatedTarget as HTMLElement)) return;\n this._removeLeaveCallbacks();\n if (this.moving) {\n event.preventDefault();\n const ev = DDUtils.initEvent(event, { target: this.el, type: 'dropout' });\n if (this.option.out) {\n this.option.out(ev, this._ui(DDManager.dragElement))\n }\n this.triggerEvent('dropout', ev);\n }\n }\n\n /** @internal item is being dropped on us - call the client drop event */\n private _drop(event: DragEvent): void {\n if (!this.moving) return; // should not have received event...\n event.preventDefault();\n const ev = DDUtils.initEvent(event, { target: this.el, type: 'drop' });\n if (this.option.drop) {\n this.option.drop(ev, this._ui(DDManager.dragElement))\n }\n this.triggerEvent('drop', ev);\n this._removeLeaveCallbacks();\n }\n\n /** @internal called to remove callbacks when leaving or dropping */\n private _removeLeaveCallbacks() {\n this.el.removeEventListener('dragleave', this._dragLeave);\n this.el.classList.remove('ui-droppable-over');\n if (this.moving) {\n this.el.removeEventListener('dragover', this._dragOver);\n this.el.removeEventListener('drop', this._drop);\n }\n }\n\n /** @internal */\n private _canDrop(): boolean {\n return DDManager.dragElement && (!this.accept || this.accept(DDManager.dragElement.el));\n }\n\n /** @internal */\n private _setupAccept(): DDDroppable {\n if (this.option.accept && typeof this.option.accept === 'string') {\n this.accept = (el: HTMLElement) => {\n return el.matches(this.option.accept as string)\n }\n } else {\n this.accept = this.option.accept as ((el: HTMLElement) => boolean);\n }\n return this;\n }\n\n /** @internal */\n private _ui(drag: DDDraggable) {\n return {\n draggable: drag.el,\n ...drag.ui()\n };\n }\n}\n\n","// dd-elements.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nimport { DDResizable, DDResizableOpt } from './dd-resizable';\nimport { GridItemHTMLElement } from './../types';\nimport { DDDraggable, DDDraggableOpt } from './dd-draggable';\nimport { DDDroppable, DDDroppableOpt } from './dd-droppable';\n\nexport interface DDElementHost extends GridItemHTMLElement {\n ddElement?: DDElement;\n}\n\nexport class DDElement {\n\n static init(el: DDElementHost): DDElement {\n if (!el.ddElement) { el.ddElement = new DDElement(el); }\n return el.ddElement;\n }\n\n public el: DDElementHost;\n public ddDraggable?: DDDraggable;\n public ddDroppable?: DDDroppable;\n public ddResizable?: DDResizable;\n\n constructor(el: DDElementHost) {\n this.el = el;\n }\n\n public on(eventName: string, callback: (event: MouseEvent) => void): DDElement {\n if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\n this.ddDraggable.on(eventName as 'drag' | 'dragstart' | 'dragstop', callback);\n } else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\n this.ddDroppable.on(eventName as 'drop' | 'dropover' | 'dropout', callback);\n } else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\n this.ddResizable.on(eventName as 'resizestart' | 'resize' | 'resizestop', callback);\n }\n return this;\n }\n\n public off(eventName: string): DDElement {\n if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\n this.ddDraggable.off(eventName as 'drag' | 'dragstart' | 'dragstop');\n } else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\n this.ddDroppable.off(eventName as 'drop' | 'dropover' | 'dropout');\n } else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\n this.ddResizable.off(eventName as 'resizestart' | 'resize' | 'resizestop');\n }\n return this;\n }\n\n public setupDraggable(opts: DDDraggableOpt): DDElement {\n if (!this.ddDraggable) {\n this.ddDraggable = new DDDraggable(this.el, opts);\n } else {\n this.ddDraggable.updateOption(opts);\n }\n return this;\n }\n\n public cleanDraggable(): DDElement {\n if (this.ddDraggable) {\n this.ddDraggable.destroy();\n delete this.ddDraggable;\n }\n return this;\n }\n\n public setupResizable(opts: DDResizableOpt): DDElement {\n if (!this.ddResizable) {\n this.ddResizable = new DDResizable(this.el, opts);\n } else {\n this.ddResizable.updateOption(opts);\n }\n return this;\n }\n\n public cleanResizable(): DDElement {\n if (this.ddResizable) {\n this.ddResizable.destroy();\n delete this.ddResizable;\n }\n return this;\n }\n\n public setupDroppable(opts: DDDroppableOpt): DDElement {\n if (!this.ddDroppable) {\n this.ddDroppable = new DDDroppable(this.el, opts);\n } else {\n this.ddDroppable.updateOption(opts);\n }\n return this;\n }\n\n public cleanDroppable(): DDElement {\n if (this.ddDroppable) {\n this.ddDroppable.destroy();\n delete this.ddDroppable;\n }\n return this;\n }\n}\n","// dd-manager.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nimport { DDDraggable } from './dd-draggable';\n\nexport class DDManager {\n static dragElement: DDDraggable;\n}\n","// dd-resizable-handle.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nexport interface DDResizableHandleOpt {\n start?: (event) => void;\n move?: (event) => void;\n stop?: (event) => void;\n}\n\nexport class DDResizableHandle {\n /** @internal */\n private el: HTMLElement;\n /** @internal */\n private host: HTMLElement;\n /** @internal */\n private option: DDResizableHandleOpt;\n /** @internal */\n private dir: string;\n /** @internal true after we've moved enough pixels to start a resize */\n private moving = false;\n /** @internal */\n private mouseDownEvent: MouseEvent;\n /** @internal */\n private static prefix = 'ui-resizable-';\n\n constructor(host: HTMLElement, direction: string, option: DDResizableHandleOpt) {\n this.host = host;\n this.dir = direction;\n this.option = option;\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n this._mouseDown = this._mouseDown.bind(this);\n this._mouseMove = this._mouseMove.bind(this);\n this._mouseUp = this._mouseUp.bind(this);\n\n this._init();\n }\n\n /** @internal */\n private _init(): DDResizableHandle {\n const el = document.createElement('div');\n el.classList.add('ui-resizable-handle');\n el.classList.add(`${DDResizableHandle.prefix}${this.dir}`);\n el.style.zIndex = '100';\n el.style.userSelect = 'none';\n this.el = el;\n this.host.appendChild(this.el);\n this.el.addEventListener('mousedown', this._mouseDown);\n return this;\n }\n\n /** call this when resize handle needs to be removed and cleaned up */\n public destroy(): DDResizableHandle {\n if (this.moving) this._mouseUp(this.mouseDownEvent);\n this.el.removeEventListener('mousedown', this._mouseDown);\n this.host.removeChild(this.el);\n delete this.el;\n delete this.host;\n return this;\n }\n\n /** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */\n private _mouseDown(e: MouseEvent): void {\n e.preventDefault();\n this.mouseDownEvent = e;\n document.addEventListener('mousemove', this._mouseMove, true); // capture, not bubble\n document.addEventListener('mouseup', this._mouseUp);\n }\n\n /** @internal */\n private _mouseMove(e: MouseEvent): void {\n let s = this.mouseDownEvent;\n // don't start unless we've moved at least 3 pixels\n if (!this.moving && Math.abs(e.x - s.x) + Math.abs(e.y - s.y) > 2) {\n this.moving = true;\n this._triggerEvent('start', this.mouseDownEvent);\n } else if (this.moving) {\n this._triggerEvent('move', e);\n }\n }\n\n /** @internal */\n private _mouseUp(e: MouseEvent): void {\n if (this.moving) {\n this._triggerEvent('stop', e);\n }\n document.removeEventListener('mousemove', this._mouseMove, true);\n document.removeEventListener('mouseup', this._mouseUp);\n delete this.moving;\n delete this.mouseDownEvent;\n }\n\n /** @internal */\n private _triggerEvent(name: string, event: MouseEvent): DDResizableHandle {\n if (this.option[name]) this.option[name](event);\n return this;\n }\n}\n","// dd-resizable.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nimport { DDResizableHandle } from './dd-resizable-handle';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { DDUtils } from './dd-utils';\nimport { Utils } from '../utils';\nimport { DDUIData, Rect, Size } from '../types';\n\n// TODO: merge with DDDragOpt\nexport interface DDResizableOpt {\n autoHide?: boolean;\n handles?: string;\n maxHeight?: number;\n maxWidth?: number;\n minHeight?: number;\n minWidth?: number;\n basePosition?: 'fixed' | 'absolute';\n start?: (event: Event, ui: DDUIData) => void;\n stop?: (event: Event) => void;\n resize?: (event: Event, ui: DDUIData) => void;\n}\n\nexport class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt {\n\n // have to be public else complains for HTMLElementExtendOpt ?\n public el: HTMLElement;\n public option: DDResizableOpt;\n\n /** @internal */\n private handlers: DDResizableHandle[];\n /** @internal */\n private originalRect: Rect;\n /** @internal */\n private temporalRect: Rect;\n /** @internal */\n private scrollY: number;\n /** @internal */\n private scrolled: number;\n /** @internal */\n private scrollEl: HTMLElement;\n /** @internal */\n private startEvent: MouseEvent;\n /** @internal value saved in the same order as _originStyleProp[] */\n private elOriginStyleVal: string[];\n /** @internal */\n private parentOriginStylePosition: string;\n /** @internal */\n private static _originStyleProp = ['width', 'height', 'position', 'left', 'top', 'opacity', 'zIndex'];\n\n constructor(el: HTMLElement, opts: DDResizableOpt = {}) {\n super();\n this.el = el;\n this.option = opts;\n this.enable();\n this._setupAutoHide();\n this._setupHandlers();\n }\n\n public on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void {\n super.on(event, callback);\n }\n\n public off(event: 'resizestart' | 'resize' | 'resizestop'): void {\n super.off(event);\n }\n\n public enable(): void {\n super.enable();\n this.el.classList.add('ui-resizable');\n this.el.classList.remove('ui-resizable-disabled');\n }\n\n public disable(): void {\n super.disable();\n this.el.classList.add('ui-resizable-disabled');\n this.el.classList.remove('ui-resizable');\n }\n\n public destroy(): void {\n this._removeHandlers();\n if (this.option.autoHide) {\n this.el.removeEventListener('mouseover', this._showHandlers);\n this.el.removeEventListener('mouseout', this._hideHandlers);\n }\n this.el.classList.remove('ui-resizable');\n delete this.el;\n super.destroy();\n }\n\n public updateOption(opts: DDResizableOpt): DDResizable {\n let updateHandles = (opts.handles && opts.handles !== this.option.handles);\n let updateAutoHide = (opts.autoHide && opts.autoHide !== this.option.autoHide);\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n if (updateHandles) {\n this._removeHandlers();\n this._setupHandlers();\n }\n if (updateAutoHide) {\n this._setupAutoHide();\n }\n return this;\n }\n\n /** @internal */\n private _setupAutoHide(): DDResizable {\n if (this.option.autoHide) {\n this.el.classList.add('ui-resizable-autohide');\n // use mouseover/mouseout instead of mouseenter/mouseleave to get better performance;\n this.el.addEventListener('mouseover', this._showHandlers);\n this.el.addEventListener('mouseout', this._hideHandlers);\n } else {\n this.el.classList.remove('ui-resizable-autohide');\n this.el.removeEventListener('mouseover', this._showHandlers);\n this.el.removeEventListener('mouseout', this._hideHandlers);\n }\n return this;\n }\n\n /** @internal */\n private _showHandlers = () => {\n this.el.classList.remove('ui-resizable-autohide');\n }\n\n /** @internal */\n private _hideHandlers = () => {\n this.el.classList.add('ui-resizable-autohide');\n }\n\n /** @internal */\n private _setupHandlers(): DDResizable {\n let handlerDirection = this.option.handles || 'e,s,se';\n if (handlerDirection === 'all') {\n handlerDirection = 'n,e,s,w,se,sw,ne,nw';\n }\n this.handlers = handlerDirection.split(',')\n .map(dir => dir.trim())\n .map(dir => new DDResizableHandle(this.el, dir, {\n start: (event: MouseEvent) => {\n this._resizeStart(event);\n },\n stop: (event: MouseEvent) => {\n this._resizeStop(event);\n },\n move: (event: MouseEvent) => {\n this._resizing(event, dir);\n }\n }));\n return this;\n }\n\n /** @internal */\n private _resizeStart(event: MouseEvent): DDResizable {\n this.originalRect = this.el.getBoundingClientRect();\n this.scrollEl = Utils.getScrollParent(this.el);\n this.scrollY = this.scrollEl.scrollTop;\n this.startEvent = event;\n this._setupHelper();\n this._applyChange();\n const ev = DDUtils.initEvent(event, { type: 'resizestart', target: this.el });\n if (this.option.start) {\n this.option.start(ev, this._ui());\n }\n this.el.classList.add('ui-resizable-resizing');\n this.triggerEvent('resizestart', ev);\n return this;\n }\n\n /** @internal */\n private _resizing(event: MouseEvent, dir: string): DDResizable {\n this.scrolled = this.scrollEl.scrollTop - this.scrollY;\n this.temporalRect = this._getChange(event, dir);\n this._applyChange();\n const ev = DDUtils.initEvent(event, { type: 'resize', target: this.el });\n if (this.option.resize) {\n this.option.resize(ev, this._ui());\n }\n this.triggerEvent('resize', ev);\n return this;\n }\n\n /** @internal */\n private _resizeStop(event: MouseEvent): DDResizable {\n const ev = DDUtils.initEvent(event, { type: 'resizestop', target: this.el });\n if (this.option.stop) {\n this.option.stop(ev); // Note: ui() not used by gridstack so don't pass\n }\n this.el.classList.remove('ui-resizable-resizing');\n this.triggerEvent('resizestop', ev);\n this._cleanHelper();\n delete this.startEvent;\n delete this.originalRect;\n delete this.temporalRect;\n delete this.scrollY;\n delete this.scrolled;\n return this;\n }\n\n /** @internal */\n private _setupHelper(): DDResizable {\n this.elOriginStyleVal = DDResizable._originStyleProp.map(prop => this.el.style[prop]);\n this.parentOriginStylePosition = this.el.parentElement.style.position;\n if (window.getComputedStyle(this.el.parentElement).position.match(/static/)) {\n this.el.parentElement.style.position = 'relative';\n }\n this.el.style.position = this.option.basePosition || 'absolute'; // or 'fixed'\n this.el.style.opacity = '0.8';\n this.el.style.zIndex = '1000';\n return this;\n }\n\n /** @internal */\n private _cleanHelper(): DDResizable {\n DDResizable._originStyleProp.forEach((prop, i) => {\n this.el.style[prop] = this.elOriginStyleVal[i] || null;\n });\n this.el.parentElement.style.position = this.parentOriginStylePosition || null;\n return this;\n }\n\n /** @internal */\n private _getChange(event: MouseEvent, dir: string): Rect {\n const oEvent = this.startEvent;\n const newRect = { // Note: originalRect is a complex object, not a simple Rect, so copy out.\n width: this.originalRect.width,\n height: this.originalRect.height + this.scrolled,\n left: this.originalRect.left,\n top: this.originalRect.top - this.scrolled\n };\n \n const offsetX = event.clientX - oEvent.clientX;\n const offsetY = event.clientY - oEvent.clientY;\n\n if (dir.indexOf('e') > -1) {\n newRect.width += event.clientX - oEvent.clientX;\n }\n if (dir.indexOf('s') > -1) {\n newRect.height += event.clientY - oEvent.clientY;\n }\n if (dir.indexOf('w') > -1) {\n newRect.width -= offsetX;\n newRect.left += offsetX;\n }\n if (dir.indexOf('n') > -1) {\n newRect.height -= offsetY;\n newRect.top += offsetY\n }\n const reshape = this._getReShapeSize(newRect.width, newRect.height);\n if (newRect.width !== reshape.width) {\n if (dir.indexOf('w') > -1) {\n newRect.left += newRect.width - reshape.width;\n }\n newRect.width = reshape.width;\n }\n if (newRect.height !== reshape.height) {\n if (dir.indexOf('n') > -1) {\n newRect.top += newRect.height - reshape.height;\n }\n newRect.height = reshape.height;\n }\n return newRect;\n }\n\n /** @internal */\n private _getReShapeSize(oWidth: number, oHeight: number): Size {\n const maxWidth = this.option.maxWidth || Number.MAX_SAFE_INTEGER;\n const minWidth = this.option.minWidth || oWidth;\n const maxHeight = this.option.maxHeight || Number.MAX_SAFE_INTEGER;\n const minHeight = this.option.minHeight || oHeight;\n const width = Math.min(maxWidth, Math.max(minWidth, oWidth));\n const height = Math.min(maxHeight, Math.max(minHeight, oHeight));\n return { width, height };\n }\n\n /** @internal */\n private _applyChange(): DDResizable {\n let containmentRect = { left: 0, top: 0, width: 0, height: 0 };\n if (this.el.style.position === 'absolute') {\n const containmentEl = this.el.parentElement;\n const { left, top } = containmentEl.getBoundingClientRect();\n containmentRect = { left, top, width: 0, height: 0 };\n }\n if (!this.temporalRect) return this;\n Object.keys(this.temporalRect).forEach(key => {\n const value = this.temporalRect[key];\n this.el.style[key] = value - containmentRect[key] + 'px';\n });\n return this;\n }\n\n /** @internal */\n private _removeHandlers(): DDResizable {\n this.handlers.forEach(handle => handle.destroy());\n delete this.handlers;\n return this;\n }\n\n /** @internal */\n private _ui = (): DDUIData => {\n const containmentEl = this.el.parentElement;\n const containmentRect = containmentEl.getBoundingClientRect();\n const newRect = { // Note: originalRect is a complex object, not a simple Rect, so copy out.\n width: this.originalRect.width,\n height: this.originalRect.height + this.scrolled,\n left: this.originalRect.left,\n top: this.originalRect.top - this.scrolled\n };\n const rect = this.temporalRect || newRect;\n return {\n position: {\n left: rect.left - containmentRect.left,\n top: rect.top - containmentRect.top\n },\n size: {\n width: rect.width,\n height: rect.height\n }\n /* Gridstack ONLY needs position set above... keep around in case.\n element: [this.el], // The object representing the element to be resized\n helper: [], // TODO: not support yet - The object representing the helper that's being resized\n originalElement: [this.el],// we don't wrap here, so simplify as this.el //The object representing the original element before it is wrapped\n originalPosition: { // The position represented as { left, top } before the resizable is resized\n left: this.originalRect.left - containmentRect.left,\n top: this.originalRect.top - containmentRect.top\n },\n originalSize: { // The size represented as { width, height } before the resizable is resized\n width: this.originalRect.width,\n height: this.originalRect.height\n }\n */\n };\n }\n}\n","// dd-utils.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\n\nexport class DDUtils {\n\n public static isEventSupportPassiveOption = ((() => {\n let supportsPassive = false;\n let passiveTest = () => {\n // do nothing\n };\n document.addEventListener('test', passiveTest, {\n get passive() {\n supportsPassive = true;\n return true;\n }\n });\n document.removeEventListener('test', passiveTest);\n return supportsPassive;\n })());\n\n public static clone(el: HTMLElement): HTMLElement {\n const node = el.cloneNode(true) as HTMLElement;\n node.removeAttribute('id');\n return node;\n }\n\n public static appendTo(el: HTMLElement, parent: string | HTMLElement | Node): void {\n let parentNode: HTMLElement;\n if (typeof parent === 'string') {\n parentNode = document.querySelector(parent as string);\n } else {\n parentNode = parent as HTMLElement;\n }\n if (parentNode) {\n parentNode.append(el);\n }\n }\n\n public static setPositionRelative(el: HTMLElement): void {\n if (!(/^(?:r|a|f)/).test(window.getComputedStyle(el).position)) {\n el.style.position = \"relative\";\n }\n }\n\n public static addElStyles(el: HTMLElement, styles: { [prop: string]: string | string[] }): void {\n if (styles instanceof Object) {\n for (const s in styles) {\n if (styles.hasOwnProperty(s)) {\n if (Array.isArray(styles[s])) {\n // support fallback value\n (styles[s] as string[]).forEach(val => {\n el.style[s] = val;\n });\n } else {\n el.style[s] = styles[s];\n }\n }\n }\n }\n }\n\n public static initEvent(e: DragEvent | MouseEvent, info: { type: string; target?: EventTarget }): T {\n const evt = { type: info.type };\n const obj = {\n button: 0,\n which: 0,\n buttons: 1,\n bubbles: true,\n cancelable: true,\n target: info.target ? info.target : e.target\n };\n // don't check for `instanceof DragEvent` as Safari use MouseEvent #1540\n if ((e as DragEvent).dataTransfer) {\n evt['dataTransfer'] = (e as DragEvent).dataTransfer; // workaround 'readonly' field.\n }\n ['altKey','ctrlKey','metaKey','shiftKey'].forEach(p => evt[p] = e[p]); // keys\n ['pageX','pageY','clientX','clientY','screenX','screenY'].forEach(p => evt[p] = e[p]); // point info\n return {...evt, ...obj} as unknown as T;\n }\n}","// gridstack-dd-native.ts 3.3.0 @preserve\n\n/**\n * https://gridstackjs.com/\n * (c) 2020 rhlin, Alain Dumesny\n * gridstack.js may be freely distributed under the MIT license.\n*/\nimport { DDManager } from './dd-manager';\nimport { DDElement, DDElementHost } from './dd-element';\n\nimport { GridStackElement } from '../gridstack';\nimport { GridStackDD, DDOpts, DDKey, DDDropOpt, DDCallback, DDValue } from '../gridstack-dd';\nimport { GridItemHTMLElement, DDDragInOpt } from '../types';\nimport { Utils } from '../utils';\n\n// export our base class (what user should use) and all associated types\nexport * from '../gridstack-dd';\n\n/**\n * HTML 5 Native DragDrop based drag'n'drop plugin.\n */\nexport class GridStackDDNative extends GridStackDD {\n\n public resizable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDDNative {\n this._getDDElements(el).forEach(dEl => {\n if (opts === 'disable' || opts === 'enable') {\n dEl.ddResizable && dEl.ddResizable[opts](); // can't create DD as it requires options for setupResizable()\n } else if (opts === 'destroy') {\n dEl.ddResizable && dEl.cleanResizable();\n } else if (opts === 'option') {\n dEl.setupResizable({ [key]: value });\n } else {\n const grid = dEl.el.gridstackNode.grid;\n let handles = dEl.el.getAttribute('gs-resize-handles') ? dEl.el.getAttribute('gs-resize-handles') : grid.opts.resizable.handles;\n dEl.setupResizable({\n ...grid.opts.resizable,\n ...{ handles: handles },\n ...{\n start: opts.start,\n stop: opts.stop,\n resize: opts.resize\n }\n });\n }\n });\n return this;\n }\n\n public draggable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDDNative {\n this._getDDElements(el).forEach(dEl => {\n if (opts === 'disable' || opts === 'enable') {\n dEl.ddDraggable && dEl.ddDraggable[opts](); // can't create DD as it requires options for setupDraggable()\n } else if (opts === 'destroy') {\n dEl.ddDraggable && dEl.cleanDraggable();\n } else if (opts === 'option') {\n dEl.setupDraggable({ [key]: value });\n } else {\n const grid = dEl.el.gridstackNode.grid;\n dEl.setupDraggable({\n ...grid.opts.draggable,\n ...{\n containment: (grid.opts._isNested && !grid.opts.dragOut)\n ? grid.el.parentElement\n : (grid.opts.draggable.containment || null),\n start: opts.start,\n stop: opts.stop,\n drag: opts.drag\n }\n });\n }\n });\n return this;\n }\n\n public dragIn(el: GridStackElement, opts: DDDragInOpt): GridStackDDNative {\n this._getDDElements(el).forEach(dEl => dEl.setupDraggable(opts));\n return this;\n }\n\n public droppable(el: GridItemHTMLElement, opts: DDOpts | DDDropOpt, key?: DDKey, value?: DDValue): GridStackDDNative {\n if (typeof opts.accept === 'function' && !opts._accept) {\n opts._accept = opts.accept;\n opts.accept = (el) => opts._accept(el);\n }\n this._getDDElements(el).forEach(dEl => {\n if (opts === 'disable' || opts === 'enable') {\n dEl.ddDroppable && dEl.ddDroppable[opts]();\n } else if (opts === 'destroy') {\n if (dEl.ddDroppable) { // error to call destroy if not there\n dEl.cleanDroppable();\n }\n } else if (opts === 'option') {\n dEl.setupDroppable({ [key]: value });\n } else {\n dEl.setupDroppable(opts);\n }\n });\n return this;\n }\n\n /** true if element is droppable */\n public isDroppable(el: DDElementHost): boolean {\n return el && el.ddElement && el.ddElement.ddDroppable && !el.ddElement.ddDroppable.disabled;\n }\n\n /** true if element is draggable */\n public isDraggable(el: DDElementHost): boolean {\n return el && el.ddElement && el.ddElement.ddDraggable && !el.ddElement.ddDraggable.disabled;\n }\n\n /** true if element is draggable */\n public isResizable(el: DDElementHost): boolean {\n return el && el.ddElement && el.ddElement.ddResizable && !el.ddElement.ddResizable.disabled;\n }\n\n public on(el: GridItemHTMLElement, name: string, callback: DDCallback): GridStackDDNative {\n this._getDDElements(el).forEach(dEl =>\n dEl.on(name, (event: Event) => {\n callback(\n event,\n DDManager.dragElement ? DDManager.dragElement.el : event.target as GridItemHTMLElement,\n DDManager.dragElement ? DDManager.dragElement.helper : null)\n })\n );\n return this;\n }\n\n public off(el: GridItemHTMLElement, name: string): GridStackDD {\n this._getDDElements(el).forEach(dEl => dEl.off(name));\n return this;\n }\n\n /** @internal returns a list of DD elements, creating them on the fly by default */\n private _getDDElements(els: GridStackElement, create = true): DDElement[] {\n let hosts = Utils.getElements(els) as DDElementHost[];\n if (!hosts.length) return [];\n let list = hosts.map(e => e.ddElement || (create ? DDElement.init(e) : null));\n if (!create) { list.filter(d => d); } // remove nulls\n return list;\n }\n}\n\n// finally register ourself\nGridStackDD.registerPlugin(GridStackDDNative);\n","// index.html5.ts 3.3.0 - everything you need for a Grid that uses HTML5 native drag&drop (work in progress) @preserve\r\n\r\n// import './gridstack-poly.js';\r\n\r\nexport * from './types';\r\nexport * from './utils';\r\nexport * from './gridstack-engine';\r\nexport * from './gridstack-ddi';\r\nexport * from './gridstack';\r\n\r\nexport * from './h5/gridstack-dd-native';\r\n\r\n// declare module 'gridstack'; for umd ?\r\n","// utils.ts 3.3.0 @preserve\r\n\r\n/**\r\n * https://gridstackjs.com/\r\n * (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov\r\n * gridstack.js may be freely distributed under the MIT license.\r\n*/\r\n\r\nimport { GridStackElement, GridStackWidget, GridStackNode, GridStackOptions, numberOrString } from './types';\r\n\r\nexport interface HeightData {\r\n h: number;\r\n unit: string;\r\n}\r\n\r\n/** checks for obsolete method names */\r\n// eslint-disable-next-line\r\nexport function obsolete(self, f, oldName: string, newName: string, rev: string): (...args: any[]) => any {\r\n let wrapper = (...args) => {\r\n console.warn('gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +\r\n 'with `' + newName + '`. It will be **completely** removed in v1.0');\r\n return f.apply(self, args);\r\n }\r\n wrapper.prototype = f.prototype;\r\n return wrapper;\r\n}\r\n\r\n/** checks for obsolete grid options (can be used for any fields, but msg is about options) */\r\nexport function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void {\r\n if (opts[oldName] !== undefined) {\r\n opts[newName] = opts[oldName];\r\n console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +\r\n newName + '`. It will be **completely** removed in v1.0');\r\n }\r\n}\r\n\r\n/** checks for obsolete grid options which are gone */\r\nexport function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void {\r\n if (opts[oldName] !== undefined) {\r\n console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);\r\n }\r\n}\r\n\r\n/** checks for obsolete Jquery element attributes */\r\nexport function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void {\r\n let oldAttr = el.getAttribute(oldName);\r\n if (oldAttr !== null) {\r\n el.setAttribute(newName, oldAttr);\r\n console.warn('gridstack.js: attribute `' + oldName + '`=' + oldAttr + ' is deprecated on this object in ' + rev + ' and has been replaced with `' +\r\n newName + '`. It will be **completely** removed in v1.0');\r\n }\r\n}\r\n\r\n/**\r\n * Utility methods\r\n */\r\nexport class Utils {\r\n\r\n /** convert a potential selector into actual list of html elements */\r\n static getElements(els: GridStackElement): HTMLElement[] {\r\n if (typeof els === 'string') {\r\n let list = document.querySelectorAll(els);\r\n if (!list.length && els[0] !== '.' && els[0] !== '#') {\r\n list = document.querySelectorAll('.' + els);\r\n if (!list.length) { list = document.querySelectorAll('#' + els) }\r\n }\r\n return Array.from(list) as HTMLElement[];\r\n }\r\n return [els];\r\n }\r\n\r\n /** convert a potential selector into actual single element */\r\n static getElement(els: GridStackElement): HTMLElement {\r\n if (typeof els === 'string') {\r\n if (!els.length) return null;\r\n if (els[0] === '#') {\r\n return document.getElementById(els.substring(1));\r\n }\r\n if (els[0] === '.' || els[0] === '[') {\r\n return document.querySelector(els);\r\n }\r\n\r\n // if we start with a digit, assume it's an id (error calling querySelector('#1')) as class are not valid CSS\r\n if(!isNaN(+els[0])) { // start with digit\r\n return document.getElementById(els);\r\n }\r\n\r\n // finally try string, then id then class\r\n let el = document.querySelector(els);\r\n if (!el) { el = document.getElementById(els) }\r\n if (!el) { el = document.querySelector('.' + els) }\r\n return el as HTMLElement;\r\n }\r\n return els;\r\n }\r\n\r\n /** returns true if a and b overlap */\r\n static isIntercepted(a: GridStackWidget, b: GridStackWidget): boolean {\r\n return !(a.x + a.w <= b.x || b.x + b.w <= a.x || a.y + a.h <= b.y || b.y + b.h <= a.y);\r\n }\r\n\r\n /**\r\n * Sorts array of nodes\r\n * @param nodes array to sort\r\n * @param dir 1 for asc, -1 for desc (optional)\r\n * @param width width of the grid. If undefined the width will be calculated automatically (optional).\r\n **/\r\n static sort(nodes: GridStackNode[], dir?: -1 | 1, column?: number): GridStackNode[] {\r\n if (!column) {\r\n let widths = nodes.map(n => n.x + n.w);\r\n column = Math.max(...widths);\r\n }\r\n\r\n if (dir === -1)\r\n return nodes.sort((a, b) => (b.x + b.y * column)-(a.x + a.y * column));\r\n else\r\n return nodes.sort((b, a) => (b.x + b.y * column)-(a.x + a.y * column));\r\n }\r\n\r\n /**\r\n * creates a style sheet with style id under given parent\r\n * @param id will set the 'gs-style-id' attribute to that id\r\n * @param parent to insert the stylesheet as first child,\r\n * if none supplied it will be appended to the document head instead.\r\n */\r\n static createStylesheet(id: string, parent?: HTMLElement): CSSStyleSheet {\r\n let style: HTMLStyleElement = document.createElement('style');\r\n style.setAttribute('type', 'text/css');\r\n style.setAttribute('gs-style-id', id);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n if ((style as any).styleSheet) { // TODO: only CSSImportRule have that and different beast ??\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (style as any).styleSheet.cssText = '';\r\n } else {\r\n style.appendChild(document.createTextNode('')); // WebKit hack\r\n }\r\n if (!parent) {\r\n // default to head\r\n parent = document.getElementsByTagName('head')[0];\r\n parent.appendChild(style);\r\n } else {\r\n parent.insertBefore(style, parent.firstChild);\r\n }\r\n return style.sheet as CSSStyleSheet;\r\n }\r\n\r\n /** removed the given stylesheet id */\r\n static removeStylesheet(id: string): void {\r\n let el = document.querySelector('STYLE[gs-style-id=' + id + ']');\r\n if (el && el.parentNode) el.remove();\r\n }\r\n\r\n /** inserts a CSS rule */\r\n static addCSSRule(sheet: CSSStyleSheet, selector: string, rules: string): void {\r\n if (typeof sheet.addRule === 'function') {\r\n sheet.addRule(selector, rules);\r\n } else if (typeof sheet.insertRule === 'function') {\r\n sheet.insertRule(`${selector}{${rules}}`);\r\n }\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n static toBool(v: unknown): boolean {\r\n if (typeof v === 'boolean') {\r\n return v;\r\n }\r\n if (typeof v === 'string') {\r\n v = v.toLowerCase();\r\n return !(v === '' || v === 'no' || v === 'false' || v === '0');\r\n }\r\n return Boolean(v);\r\n }\r\n\r\n static toNumber(value: null | string): number {\r\n return (value === null || value.length === 0) ? undefined : Number(value);\r\n }\r\n\r\n static parseHeight(val: numberOrString): HeightData {\r\n let h: number;\r\n let unit = 'px';\r\n if (typeof val === 'string') {\r\n let match = val.match(/^(-[0-9]+\\.[0-9]+|[0-9]*\\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%)?$/);\r\n if (!match) {\r\n throw new Error('Invalid height');\r\n }\r\n unit = match[2] || 'px';\r\n h = parseFloat(match[1]);\r\n } else {\r\n h = val;\r\n }\r\n return { h, unit };\r\n }\r\n\r\n /** copies unset fields in target to use the given default sources values */\r\n // eslint-disable-next-line\r\n static defaults(target, ...sources): {} {\r\n\r\n sources.forEach(source => {\r\n for (const key in source) {\r\n if (!source.hasOwnProperty(key)) return;\r\n if (target[key] === null || target[key] === undefined) {\r\n target[key] = source[key];\r\n } else if (typeof source[key] === 'object' && typeof target[key] === 'object') {\r\n // property is an object, recursively add it's field over... #1373\r\n this.defaults(target[key], source[key]);\r\n }\r\n }\r\n });\r\n\r\n return target;\r\n }\r\n\r\n /** given 2 objects return true if they have the same values. Checks for Object {} having same fields and values (just 1 level down) */\r\n static same(a: unknown, b: unknown): boolean {\r\n if (typeof a !== 'object') return a == b;\r\n if (typeof a !== typeof b) return false;\r\n // else we have object, check just 1 level deep for being same things...\r\n if (Object.keys(a).length !== Object.keys(b).length) return false;\r\n for (const key in a) {\r\n if (a[key] !== b[key]) return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */\r\n static removeInternalAndSame(a: unknown, b: unknown):void {\r\n if (typeof a !== 'object' || typeof b !== 'object') return;\r\n for (let key in a) {\r\n let val = a[key];\r\n if (val && typeof val === 'object') {\r\n for (let i in val) {\r\n if (val[i] === b[key][i] || i[0] === '_') { delete val[i] }\r\n }\r\n if (!Object.keys(val).length) { delete a[key] }\r\n } else if (val === b[key] || key[0] === '_') { delete a[key] }\r\n }\r\n }\r\n\r\n /** return the closest parent matching the given class */\r\n static closestByClass(el: HTMLElement, name: string): HTMLElement {\r\n\r\n while(el = el.parentElement) {\r\n if (el.classList.contains(name)) return el;\r\n }\r\n return null;\r\n }\r\n\r\n /** delay calling the given function for given delay, preventing new calls from happening while waiting */\r\n static throttle(func: () => void, delay: number): () => void {\r\n let isWaiting = false;\r\n return (...args) => {\r\n if (!isWaiting) {\r\n isWaiting = true;\r\n setTimeout(() => { func(...args); isWaiting = false; }, delay);\r\n }\r\n }\r\n }\r\n\r\n static removePositioningStyles(el: HTMLElement): void {\r\n let style = el.style;\r\n if (style.position) {\r\n style.removeProperty('position');\r\n }\r\n if (style.left) {\r\n style.removeProperty('left');\r\n }\r\n if (style.top) {\r\n style.removeProperty('top');\r\n }\r\n if (style.width) {\r\n style.removeProperty('width');\r\n }\r\n if (style.height) {\r\n style.removeProperty('height');\r\n }\r\n }\r\n\r\n /** @internal */\r\n static getScrollParent(el: HTMLElement): HTMLElement {\r\n if (el === null) return document.documentElement;\r\n const style = getComputedStyle(el);\r\n const overflowRegex = /(auto|scroll)/;\r\n\r\n if (overflowRegex.test(style.overflow + style.overflowY)) {\r\n return el;\r\n } else {\r\n return this.getScrollParent(el.parentElement);\r\n }\r\n }\r\n\r\n /** @internal */\r\n static updateScrollPosition(el: HTMLElement, position: {top: number}, distance: number): void {\r\n // is widget in view?\r\n let rect = el.getBoundingClientRect();\r\n let innerHeightOrClientHeight = (window.innerHeight || document.documentElement.clientHeight);\r\n if (rect.top < 0 ||\r\n rect.bottom > innerHeightOrClientHeight\r\n ) {\r\n // set scrollTop of first parent that scrolls\r\n // if parent is larger than el, set as low as possible\r\n // to get entire widget on screen\r\n let offsetDiffDown = rect.bottom - innerHeightOrClientHeight;\r\n let offsetDiffUp = rect.top;\r\n let scrollEl = this.getScrollParent(el);\r\n if (scrollEl !== null) {\r\n let prevScroll = scrollEl.scrollTop;\r\n if (rect.top < 0 && distance < 0) {\r\n // moving up\r\n if (el.offsetHeight > innerHeightOrClientHeight) {\r\n scrollEl.scrollTop += distance;\r\n } else {\r\n scrollEl.scrollTop += Math.abs(offsetDiffUp) > Math.abs(distance) ? distance : offsetDiffUp;\r\n }\r\n } else if (distance > 0) {\r\n // moving down\r\n if (el.offsetHeight > innerHeightOrClientHeight) {\r\n scrollEl.scrollTop += distance;\r\n } else {\r\n scrollEl.scrollTop += offsetDiffDown > distance ? distance : offsetDiffDown;\r\n }\r\n }\r\n // move widget y by amount scrolled\r\n position.top += scrollEl.scrollTop - prevScroll;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal Function used to scroll the page.\r\n *\r\n * @param event `MouseEvent` that triggers the resize\r\n * @param el `HTMLElement` that's being resized\r\n * @param distance Distance from the V edges to start scrolling\r\n */\r\n static updateScrollResize(event: MouseEvent, el: HTMLElement, distance: number): void {\r\n const scrollEl = this.getScrollParent(el);\r\n const height = scrollEl.clientHeight;\r\n\r\n const top = event.clientY < distance;\r\n const bottom = event.clientY > height - distance;\r\n\r\n if (top) {\r\n // This also can be done with a timeout to keep scrolling while the mouse is\r\n // in the scrolling zone. (will have smoother behavior)\r\n scrollEl.scrollBy({ behavior: 'smooth', top: event.clientY - distance});\r\n } else if (bottom) {\r\n scrollEl.scrollBy({ behavior: 'smooth', top: distance - (height - event.clientY)});\r\n }\r\n }\r\n}\r\n\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(117);\n"],"sourceRoot":""}