{"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-h5.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/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","_itemRemoving","remove","node","undefined","grid","_isAboutToRemove","classList","add","GridStack","prototype","_setupAcceptWidget","opts","staticGrid","acceptWidgets","removable","droppable","cellHeight","cellWidth","onDrag","event","helper","parent","getBoundingClientRect","top","left","ui","position","_temporaryRemoved","x","Math","max","round","y","autoPosition","engine","nodeBoundFix","willItFit","off","_willFitPos","Utils","copyPos","_onStartMoving","_dragOrResize","accept","subGrid","canAccept","selector","matches","maxRow","n","w","h","minW","minH","on","_leave","getCellHeight","_readAttr","_isExternal","offsetWidth","offsetHeight","_gridstackNodeOrig","cleanupNode","wasAdded","placeholder","parentElement","origNode","oGrid","removedNodes","push","_triggerRemoveEvent","cloneNode","removePositioningStyles","_writeAttr","appendChild","_updateContainerHeight","addedNodes","_triggerAddEvent","_triggerChangeEvent","endUpdate","_gsEventHandler","type","window","setTimeout","_prepareDragDropByNode","removeNode","_setupRemoveDrop","trashEl","document","querySelector","isDroppable","removableOptions","setupDragIn","_dragIn","_dragInOptions","dragIn","dragInOptions","revert","handle","scroll","appendTo","dd","getElements","forEach","isDraggable","noMove","disableDrag","noResize","disableResize","onStartMoving","target","dragOrResize","onEndMoving","_moving","_lastTried","gridToNotify","_orig","_writePosAttr","addNode","_extraDragRow","start","stop","drag","resize","cleanNodes","beginUpdate","_lastUiPosition","_prevYPix","cacheRects","marginTop","marginRight","marginBottom","marginLeft","maxW","maxH","restoreInitial","resizing","p","mLeft","mRight","mTop","mBottom","mHeight","mWidth","min","distance","updateScrollPosition","prev","collide","row","getRow","extra","updateScrollResize","size","width","height","rect","moveNodeCheck","_skipDown","onParentResize","movable","els","val","disable","enableMove","enableResize","_triggerEvent","enable","doEnable","nodes","pluginClass","ddi","registerPlugin","GridStackEngine","column","onChange","_float","float","batchMode","_prevFloat","saveInitial","_packNodes","_notify","nn","_hasLocked","opt","_sortNodes","nested","swap","area","_useEntireRowArea","skip","didMove","newOpt","pack","moved","locked","moveNode","skip2","find","isIntercepted","filter","o","collides","_rect","r0","r","r2","yOver","Number","MAX_VALUE","xOver","overMax","over","right","bottom","a","b","_doSwap","_dirty","touching","isTouching","t","length","batchUpdate","copyNodes","commit","dir","sort","_updating","newY","i","_id","_idSeq","defaults","isNaN","before","_inColumnResize","cacheOneLayout","samePos","verify","removeDOM","dirtyNodes","Array","isArray","concat","getDirtyNodes","some","triggerAddEvent","dup","prepareNode","_removeDOM","floor","box","_fixCollisions","triggerEvent","_layouts","changedPosConstrain","clonedNode","clone","map","canMove","c","content","prevPos","collideAll","needToMove","collideCoverage","reduce","saveElement","len","layout","list","wl","l","key","ratio","prevColumn","cacheLayout","newNodes","domOrder","cacheNodes","lastIndex","cacheNode","j","findIndex","splice","move","scale","clear","copy","index","prop","GridDefaults","minRow","itemClass","placeholderClass","placeholderText","handleClass","styleInHead","cellHeightThrottle","margin","auto","minWidth","animate","alwaysShowResizeHandle","autoHide","handles","rtl","marginUnit","cellHeightUnit","disableOneColumnMode","oneColumnModeDomSort","rowAttr","toNumber","getAttribute","cloneDeep","toBool","_styleSheetClass","random","toFixed","initMargin","_widthOrContainer","_prevColumn","getColumn","style","direction","parentGridItemEl","closestByClass","_isNested","_isAutoCellHeight","_setStaticClass","cbNodes","_updateStyles","elements","getGridItems","parseInt","e","_prepareElement","setAnimation","_updateWindowResizeEvent","options","elOrString","getGridElement","gridstack","console","error","grids","getGridElements","contains","doc","implementation","createHTMLDocument","body","innerHTML","class","children","init","load","_placeholder","placeholderChild","createElement","className","arguments","warn","id","addWidget","domAttr","_insertNotAppend","prepend","autoColumn","ops","addGrid","_autoColumn","saveContent","saveGridOpt","save","sub","removeInternalAndSame","addAndRemove","items","_ignoreLayoutsNodeChange","removed","removeWidget","item","update","forcePixel","rows","marginDiff","data","parseHeight","unit","clientWidth","innerWidth","compact","domNodes","oldColumn","updateNodeWidths","from","setStatic","parentNode","removeChild","removeAll","_removeStylesheet","removeAttribute","useDocRelative","containerPos","documentElement","scrollTop","offsetTop","offsetLeft","relativeLeft","relativeTop","columnWidth","rowHeight","isAreaEmpty","getElement","name","callback","indexOf","split","noData","detail","addEventListener","log","removeEventListener","doAnimate","updateClass","m","keys","k","changed","ddChanged","value","layoutsNodesChange","CustomEvent","bubbles","Event","dispatchEvent","_styles","removeStylesheet","forceUpdate","prefix","styleLocation","createStylesheet","_max","addCSSRule","getHeight","setAttribute","String","removeProperty","same","attrs","resizeHandles","hasOwnProperty","classes","changedColumn","oneColumn","_cellHeightThrottle","throttle","forceRemove","workTodo","_windowResizeBind","bind","margins","Engine","_disabled","_eventRegister","eventName","disabled","DDDraggable","DDBaseImplement","option","super","dragging","containmentRect","offset","substring","dragEl","_dragStart","_drag","_dragEnd","forDestroy","destroy","Object","DDManager","dragElement","_createHelper","_setupHelperContainmentStyle","dragOffset","_getDragOffset","helperContainment","ev","DDUtils","initEvent","_setupDragFollowNodeNotifyStart","_dragFollow","dragFollowTimer","_cancelDragGhost","_setupHelperStyle","dragEventListenerOption","preventDefault","clearTimeout","paintTimer","cancelAnimationFrame","parentOriginStylePosition","_removeHelperStyle","dragElementOriginStyle","originStyleProp","rec","pointerEvents","willChange","transition","requestAnimationFrame","clientX","clientY","getComputedStyle","match","img","dataTransfer","setDragImage","stopPropagation","xformOffsetX","xformOffsetY","testEl","addElStyles","opacity","zIndex","testElPosition","targetOffset","DDDroppable","_dragEnter","_dragOver","_dragLeave","_drop","_setupAccept","_removeLeaveCallbacks","_canDrop","moving","_ui","lastActive","forceLeave","onChild","inside","out","drop","DDElement","ddElement","ddDraggable","ddDroppable","ddResizable","updateOption","DDResizable","DDResizableHandle","host","_mouseDown","_mouseMove","_mouseUp","_init","userSelect","mouseDownEvent","s","abs","_showHandlers","_hideHandlers","newRect","originalRect","scrolled","temporalRect","_setupAutoHide","_setupHandlers","_removeHandlers","updateHandles","updateAutoHide","handlerDirection","handlers","trim","_resizeStart","_resizeStop","_resizing","scrollEl","getScrollElement","scrollY","startEvent","_setupHelper","_applyChange","_getChange","_cleanHelper","elOriginStyleVal","_originStyleProp","oEvent","offsetX","offsetY","constrain","_constrainSize","oWidth","oHeight","maxWidth","MAX_SAFE_INTEGER","maxHeight","minHeight","containmentEl","test","styles","info","evt","obj","button","which","buttons","cancelable","relatedTarget","fromElement","isEventSupportPassiveOption","supportsPassive","passiveTest","GridStackDDNative","_getDDElements","dEl","cleanResizable","setupResizable","cleanDraggable","setupDraggable","containment","dragOut","_accept","cleanDroppable","setupDroppable","create","hosts","d","f","oldName","newName","rev","wrapper","args","apply","oldAttr","querySelectorAll","getElementById","col","styleSheet","cssText","createTextNode","insertBefore","firstChild","getElementsByTagName","sheet","rules","addRule","insertRule","v","toLowerCase","Boolean","Error","parseFloat","sources","source","minMax","func","delay","isWaiting","scrollingElement","overflow","overflowY","innerHeightOrClientHeight","innerHeight","clientHeight","offsetDiffDown","offsetDiffUp","prevScroll","pointerPosY","scrollBy","behavior","ret","skipFields","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","call"],"mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxC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A2B,GCE3BC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBrqB,IAAjBsqB,EACH,OAAOA,EAAavrB,QAGrB,IAAIC,EAASkrB,EAAyBG,GAAY,CAGjDtrB,QAAS,IAOV,OAHAwrB,EAAoBF,GAAUG,KAAKxrB,EAAOD,QAASC,EAAQA,EAAOD,QAASqrB,GAGpEprB,EAAOD,QClBWqrB,CAAoB,K","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 ","/**\r\n * gridstack-dd.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\n\r\n/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { GridStackDDI } from './gridstack-ddi';\r\nimport { GridItemHTMLElement, GridStackNode, GridStackElement, DDUIData, DDDragInOpt, GridStackPosition } from './types';\r\nimport { GridStack, MousePosition } 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// TEST let count = 0;\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 * 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 to support widgets being added externally */\r\nGridStack.prototype._setupAcceptWidget = function(this: GridStack): GridStack {\r\n\r\n // check if we need to disable things\r\n if (this.opts.staticGrid || (!this.opts.acceptWidgets && !this.opts.removable)) {\r\n GridStackDD.get().droppable(this.el, 'destroy');\r\n return this;\r\n }\r\n\r\n // vars shared across all methods\r\n let cellHeight: number, cellWidth: number;\r\n\r\n let onDrag = (event: DragEvent, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n let node = el.gridstackNode;\r\n if (!node) return;\r\n\r\n helper = helper || el;\r\n let parent = this.el.getBoundingClientRect();\r\n let {top, left} = helper.getBoundingClientRect();\r\n left -= parent.left;\r\n top -= parent.top;\r\n let ui: DDUIData = {position: {top, left}};\r\n\r\n if (node._temporaryRemoved) {\r\n node.x = Math.max(0, Math.round(left / cellWidth));\r\n node.y = Math.max(0, Math.round(top / cellHeight));\r\n delete node.autoPosition;\r\n this.engine.nodeBoundFix(node);\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)) {\r\n GridStackDD.get().off(el, 'drag'); // stop calling us\r\n return; // full grid or can't grow\r\n }\r\n if (node._willFitPos) {\r\n // use the auto position instead #1687\r\n Utils.copyPos(node, node._willFitPos);\r\n delete node._willFitPos;\r\n }\r\n }\r\n\r\n // re-use the existing node dragging method\r\n this._onStartMoving(helper, event, ui, node, cellWidth, cellHeight);\r\n } else {\r\n // re-use the existing node dragging that does so much of the collision detection\r\n this._dragOrResize(helper, event, ui, node, cellWidth, cellHeight);\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?.grid === this) return true;\r\n if (!this.opts.acceptWidgets) return false;\r\n // prevent deeper nesting until rest of 992 can be fixed\r\n if (node?.subGrid) return false;\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 and autoPosition\r\n canAccept = this.engine.willItFit(n);\r\n }\r\n return canAccept;\r\n }\r\n })\r\n /**\r\n * entering our grid area\r\n */\r\n .on(this.el, 'dropover', (event: Event, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n // TEST console.log(`over ${this.el.gridstack.opts.id} ${count++}`);\r\n let node = el.gridstackNode;\r\n // ignore drop enter on ourself (unless we temporarily removed) which happens on a simple drag of our item\r\n if (node?.grid === this && !node._temporaryRemoved) {\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; // prevent parent from receiving msg (which may be a grid as well)\r\n }\r\n\r\n // fix #1578 when dragging fast, we may not get a leave on the previous grid so force one now\r\n if (node?.grid && node.grid !== this && !node._temporaryRemoved) {\r\n // TEST console.log('dropover without leave');\r\n let otherGrid = node.grid;\r\n otherGrid._leave(el, helper);\r\n }\r\n\r\n // cache cell dimensions (which don't change), position can animate if we removed an item in otherGrid that affects us...\r\n cellWidth = this.cellWidth();\r\n cellHeight = this.getCellHeight(true);\r\n\r\n // load any element attributes if we don't have a node\r\n if (!node) {// @ts-ignore private read only on ourself\r\n node = this._readAttr(el);\r\n }\r\n if (!node.grid) {\r\n node._isExternal = true;\r\n el.gridstackNode = node;\r\n }\r\n\r\n // calculate the grid size based on element outer size\r\n helper = helper || el;\r\n let w = node.w || Math.round(helper.offsetWidth / cellWidth) || 1;\r\n let h = node.h || Math.round(helper.offsetHeight / cellHeight) || 1;\r\n\r\n // if the item came from another grid, make a copy and save the original info in case we go back there\r\n if (node.grid && node.grid !== this) {\r\n // copy the node original values (min/max/id/etc...) but override width/height/other flags which are this grid specific\r\n // TEST console.log('dropover cloning node');\r\n if (!el._gridstackNodeOrig) el._gridstackNodeOrig = node; // shouldn't have multiple nested!\r\n el.gridstackNode = node = {...node, w, h, grid: this};\r\n this.engine.cleanupNode(node)\r\n .nodeBoundFix(node);\r\n // restore some internal fields we need after clearing them all\r\n node._initDD =\r\n node._isExternal = // DOM needs to be re-parented on a drop\r\n node._temporaryRemoved = true; // so it can be inserted onDrag below\r\n } else {\r\n node.w = w; node.h = h;\r\n node._temporaryRemoved = true; // so we can insert it\r\n }\r\n\r\n // clear any marked for complete removal (Note: don't check _isAboutToRemove as that is cleared above - just do it)\r\n _itemRemoving(node.el, false);\r\n\r\n GridStackDD.get().on(el, 'drag', onDrag);\r\n // make sure this is called at least once when going fast #1578\r\n onDrag(event as DragEvent, el, helper);\r\n return false; // prevent parent from receiving msg (which may be a grid as well)\r\n })\r\n /**\r\n * Leaving our grid area...\r\n */\r\n .on(this.el, 'dropout', (event, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n // TEST console.log(`out ${this.el.gridstack.opts.id} ${count++}`);\r\n let node = el.gridstackNode;\r\n if (!node) return false;\r\n // fix #1578 when dragging fast, we might get leave after other grid gets enter (which calls us to clean)\r\n // so skip this one if we're not the active grid really..\r\n if (!node.grid || node.grid === this) {\r\n this._leave(el, helper);\r\n }\r\n return false; // prevent parent from receiving msg (which may be grid as well)\r\n })\r\n /**\r\n * end - releasing the mouse\r\n */\r\n .on(this.el, 'drop', (event, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n let node = el.gridstackNode;\r\n // ignore drop on ourself from ourself that didn't come from the outside - dragend will handle the simple move instead\r\n if (node?.grid === this && !node._isExternal) return false;\r\n\r\n let wasAdded = !!this.placeholder.parentElement; // skip items not actually added to us because of constrains, but do cleanup #1419\r\n this.placeholder.remove();\r\n\r\n // notify previous grid of removal\r\n // TEST console.log('drop delete _gridstackNodeOrig')\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.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 this.engine.cleanupNode(node); // removes all internal _xyz values\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 jquery-ui 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 // @ts-ignore\r\n Utils.copyPos(node, this._readAttr(this.placeholder)); // placeholder values as moving VERY fast can throw things off #1578\r\n Utils.removePositioningStyles(el);// @ts-ignore\r\n this._writeAttr(el, node);\r\n this.el.appendChild(el);// @ts-ignore\r\n this._updateContainerHeight();\r\n this.engine.addedNodes.push(node);// @ts-ignore\r\n this._triggerAddEvent();// @ts-ignore\r\n this._triggerChangeEvent();\r\n\r\n this.engine.endUpdate();\r\n if (this._gsEventHandler['dropped']) {\r\n this._gsEventHandler['dropped']({...event, 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 window.setTimeout(() => {\r\n // IFF we are still there (some application will use as placeholder and insert their real widget instead and better call makeWidget())\r\n if (node.el && node.el.parentElement) {\r\n this._prepareDragDropByNode(node);\r\n } else {\r\n this.engine.removeNode(node);\r\n }\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 mark item for removal */\r\nfunction _itemRemoving(el: GridItemHTMLElement, remove: boolean) {\r\n let node = el ? el.gridstackNode : undefined;\r\n if (!node || !node.grid) return;\r\n remove ? node._isAboutToRemove = true : delete node._isAboutToRemove;\r\n remove ? el.classList.add('grid-stack-item-removing') : el.classList.remove('grid-stack-item-removing');\r\n}\r\n\r\n/** @internal called to setup a trash drop zone if the user specifies it */\r\nGridStack.prototype._setupRemoveDrop = function(this: GridStack): 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 drop-over/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', (event, el) => _itemRemoving(el, true))\r\n .on(trashEl, 'dropout', (event, el) => _itemRemoving(el, false));\r\n }\r\n }\r\n return this;\r\n}\r\n\r\n/**\r\n * call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.\r\n * Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar\r\n * is dynamically create and needs to change later.\r\n **/\r\nGridStack.setupDragIn = function(this: GridStack, _dragIn?: string, _dragInOptions?: DDDragInOpt) {\r\n let dragIn: string;\r\n let dragInOptions: DDDragInOpt;\r\n const dragInDefaultOptions: DDDragInOpt = {\r\n revert: 'invalid',\r\n handle: '.grid-stack-item-content',\r\n scroll: false,\r\n appendTo: 'body'\r\n };\r\n\r\n // cache in the passed in values (form grid init?) so they don't have to resend them each time\r\n if (_dragIn) {\r\n dragIn = _dragIn;\r\n dragInOptions = {...dragInDefaultOptions, ...(_dragInOptions || {})};\r\n }\r\n if (typeof dragIn !== 'string') return;\r\n let dd = GridStackDD.get();\r\n Utils.getElements(dragIn).forEach(el => {\r\n if (!dd.isDraggable(el)) dd.dragIn(el, dragInOptions);\r\n });\r\n}\r\n\r\n/** @internal prepares the element for drag&drop **/\r\nGridStack.prototype._prepareDragDropByNode = function(this: GridStack, node: GridStackNode): GridStack {\r\n let el = node.el;\r\n let dd = GridStackDD.get();\r\n\r\n // check for disabled grid first\r\n if (this.opts.staticGrid || ((node.noMove || this.opts.disableDrag) && (node.noResize || this.opts.disableResize))) {\r\n if (node._initDD) {\r\n dd.remove(el); // nukes everything instead of just disable, will add some styles back next\r\n delete node._initDD;\r\n }\r\n el.classList.add('ui-draggable-disabled', 'ui-resizable-disabled'); // add styles one might depend on #1435\r\n return this;\r\n }\r\n\r\n if (!node._initDD) {\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) => {\r\n // trigger any 'dragstart' / 'resizestart' manually\r\n if (this._gsEventHandler[event.type]) {\r\n this._gsEventHandler[event.type](event, event.target);\r\n }\r\n cellWidth = this.cellWidth();\r\n cellHeight = this.getCellHeight(true); // force pixels for calculations\r\n\r\n this._onStartMoving(el, event, ui, node, cellWidth, cellHeight);\r\n }\r\n\r\n /** called when item is being dragged/resized */\r\n let dragOrResize = (event: Event, ui: DDUIData) => {\r\n this._dragOrResize(el, event, ui, node, cellWidth, cellHeight);\r\n }\r\n\r\n /** called when the item stops moving/resizing */\r\n let onEndMoving = (event: Event) => {\r\n this.placeholder.remove();\r\n delete node._moving;\r\n delete node._lastTried;\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 dd.remove(el);\r\n gridToNotify.engine.removedNodes.push(node);\r\n gridToNotify._triggerRemoveEvent();\r\n // break circular links and remove DOM\r\n delete el.gridstackNode;\r\n delete node.el;\r\n el.remove();\r\n } else {\r\n if (!node._temporaryRemoved) {\r\n // move to new placeholder location\r\n Utils.removePositioningStyles(target);// @ts-ignore\r\n this._writePosAttr(target, node);\r\n } else {\r\n // got removed - restore item back to before dragging position\r\n Utils.removePositioningStyles(target);\r\n Utils.copyPos(node, node._orig);// @ts-ignore\r\n this._writePosAttr(target, node);\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 // @ts-ignore\r\n this._extraDragRow = 0;// @ts-ignore\r\n this._updateContainerHeight();// @ts-ignore\r\n this._triggerChangeEvent();\r\n\r\n this.engine.endUpdate();\r\n }\r\n\r\n dd.draggable(el, {\r\n start: onStartMoving,\r\n stop: onEndMoving,\r\n drag: dragOrResize\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\r\n // finally fine tune move vs resize by disabling any part...\r\n if (node.noMove || this.opts.disableDrag) {\r\n dd.draggable(el, 'disable');\r\n el.classList.add('ui-draggable-disabled');\r\n } else {\r\n dd.draggable(el, 'enable');\r\n el.classList.remove('ui-draggable-disabled');\r\n }\r\n if (node.noResize || this.opts.disableResize) {\r\n dd.resizable(el, 'disable');\r\n el.classList.add('ui-resizable-disabled');\r\n } else {\r\n dd.resizable(el, 'enable');\r\n el.classList.remove('ui-resizable-disabled');\r\n }\r\n\r\n return this;\r\n}\r\n\r\n/** @internal called when item is starting a drag/resize */\r\nGridStack.prototype._onStartMoving = function(this: GridStack, el: GridItemHTMLElement, event: Event, ui: DDUIData, node: GridStackNode, cellWidth: number, cellHeight: number) {\r\n this.engine.cleanNodes()\r\n .beginUpdate(node);\r\n // @ts-ignore\r\n this._writePosAttr(this.placeholder, node)\r\n this.el.appendChild(this.placeholder);\r\n // TEST console.log('_onStartMoving placeholder')\r\n\r\n node.el = this.placeholder;\r\n node._lastUiPosition = ui.position;\r\n node._prevYPix = ui.position.top;\r\n node._moving = (event.type === 'dragstart'); // 'dropover' are not initially moving so they can go exactly where they enter (will push stuff out of the way)\r\n delete node._lastTried;\r\n\r\n if (event.type === 'dropover' && node._temporaryRemoved) {\r\n // TEST console.log('engine.addNode x=' + node.x);\r\n this.engine.addNode(node); // will add, fix collisions, update attr and clear _temporaryRemoved\r\n node._moving = true; // AFTER, mark as moving object (wanted fix location before)\r\n }\r\n\r\n // set the min/max resize info\r\n this.engine.cacheRects(cellWidth, cellHeight, this.opts.marginTop as number, this.opts.marginRight as number, this.opts.marginBottom as number, this.opts.marginLeft as number);\r\n if (event.type === 'resizestart') {\r\n let dd = GridStackDD.get()\r\n .resizable(el, 'option', 'minWidth', cellWidth * (node.minW || 1))\r\n .resizable(el, 'option', 'minHeight', cellHeight * (node.minH || 1));\r\n if (node.maxW) { dd.resizable(el, 'option', 'maxWidth', cellWidth * node.maxW); }\r\n if (node.maxH) { dd.resizable(el, 'option', 'maxHeight', cellHeight * node.maxH); }\r\n }\r\n}\r\n\r\n/** @internal called when item leaving our area by either cursor dropout event\r\n * or shape is outside our boundaries. remove it from us, and mark temporary if this was\r\n * our item to start with else restore prev node values from prev grid it came from.\r\n **/\r\nGridStack.prototype._leave = function(this: GridStack, el: GridItemHTMLElement, helper?: GridItemHTMLElement) {\r\n let node = el.gridstackNode;\r\n if (!node) return;\r\n\r\n GridStackDD.get().off(el, 'drag'); // no need to track while being outside\r\n\r\n // this gets called when cursor leaves and shape is outside, so only do this once\r\n if (node._temporaryRemoved) return;\r\n node._temporaryRemoved = true;\r\n\r\n this.engine.removeNode(node); // remove placeholder as well, otherwise it's a sign node is not in our list, which is a bigger issue\r\n node.el = node._isExternal && helper ? helper : el; // point back to real item being dragged\r\n\r\n if (this.opts.removable === true) { // boolean vs a class string\r\n // item leaving us and we are supposed to remove on leave (no need to drag onto trash) mark it so\r\n _itemRemoving(el, true);\r\n }\r\n\r\n // finally if item originally came from another grid, but left us, restore things back to prev info\r\n if (el._gridstackNodeOrig) {\r\n // TEST console.log('leave delete _gridstackNodeOrig')\r\n el.gridstackNode = el._gridstackNodeOrig;\r\n delete el._gridstackNodeOrig;\r\n } else if (node._isExternal) {\r\n // item came from outside (like a toolbar) so nuke any node info\r\n delete node.el;\r\n delete el.gridstackNode;\r\n // and restore all nodes back to original\r\n this.engine.restoreInitial();\r\n }\r\n}\r\n\r\n/** @internal called when item is being dragged/resized */\r\nGridStack.prototype._dragOrResize = function(this: GridStack, el: GridItemHTMLElement, event: Event, ui: DDUIData, node: GridStackNode, cellWidth: number, cellHeight: number) {\r\n let p = {...node._orig}; // could be undefined (_isExternal) which is ok (drag only set x,y and w,h will default to node value)\r\n let resizing: boolean;\r\n let mLeft = this.opts.marginLeft as number,\r\n mRight = this.opts.marginRight as number,\r\n mTop = this.opts.marginTop as number,\r\n mBottom = this.opts.marginBottom as number;\r\n\r\n // if margins (which are used to pass mid point by) are large relative to cell height/width, reduce them down #1855\r\n let mHeight = Math.round(cellHeight * 0.1),\r\n mWidth = Math.round(cellWidth * 0.1);\r\n mLeft = Math.min(mLeft, mWidth);\r\n mRight = Math.min(mRight, mWidth);\r\n mTop = Math.min(mTop, mHeight);\r\n mBottom = Math.min(mBottom, mHeight);\r\n\r\n if (event.type === 'drag') {\r\n if (node._temporaryRemoved) return; // handled by dropover\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\r\n // get new position taking into account the margin in the direction we are moving! (need to pass mid point by margin)\r\n let left = ui.position.left + (ui.position.left > node._lastUiPosition.left ? -mRight : mLeft);\r\n let top = ui.position.top + (ui.position.top > node._lastUiPosition.top ? -mBottom : mTop);\r\n p.x = Math.round(left / cellWidth);\r\n p.y = Math.round(top / cellHeight);\r\n\r\n // @ts-ignore// if we're at the bottom hitting something else, grow the grid so cursor doesn't leave when trying to place below others\r\n let prev = this._extraDragRow;\r\n if (this.engine.collide(node, p)) {\r\n let row = this.getRow();\r\n let extra = Math.max(0, (p.y + node.h) - row);\r\n if (this.opts.maxRow && row + extra > this.opts.maxRow) {\r\n extra = Math.max(0, this.opts.maxRow - row);\r\n }// @ts-ignore\r\n this._extraDragRow = extra;// @ts-ignore\r\n } else this._extraDragRow = 0;// @ts-ignore\r\n if (this._extraDragRow !== prev) this._updateContainerHeight();\r\n\r\n if (node.x === p.x && node.y === p.y) return; // skip same\r\n // DON'T skip one we tried as we might have failed because of coverage <50% before\r\n // if (node._lastTried && node._lastTried.x === x && node._lastTried.y === y) return;\r\n } else if (event.type === 'resize') {\r\n if (p.x < 0) return;\r\n // Scrolling page if needed\r\n Utils.updateScrollResize(event as MouseEvent, el, cellHeight);\r\n\r\n // get new size\r\n p.w = Math.round((ui.size.width - mLeft) / cellWidth);\r\n p.h = Math.round((ui.size.height - mTop) / cellHeight);\r\n if (node.w === p.w && node.h === p.h) return;\r\n if (node._lastTried && node._lastTried.w === p.w && node._lastTried.h === p.h) return; // skip one we tried (but failed)\r\n\r\n // if we size on left/top side this might move us, so get possible new position as well\r\n let left = ui.position.left + mLeft;\r\n let top = ui.position.top + mTop;\r\n p.x = Math.round(left / cellWidth);\r\n p.y = Math.round(top / cellHeight);\r\n\r\n resizing = true;\r\n }\r\n\r\n node._lastTried = p; // set as last tried (will nuke if we go there)\r\n let rect: GridStackPosition = { // screen pix of the dragged box\r\n x: ui.position.left + mLeft,\r\n y: ui.position.top + mTop,\r\n w: (ui.size ? ui.size.width : node.w * cellWidth) - mLeft - mRight,\r\n h: (ui.size ? ui.size.height : node.h * cellHeight) - mTop - mBottom\r\n };\r\n if (this.engine.moveNodeCheck(node, {...p, cellWidth, cellHeight, rect, resizing})) {\r\n node._lastUiPosition = ui.position;\r\n this.engine.cacheRects(cellWidth, cellHeight, mTop, mRight, mBottom, mLeft);\r\n delete node._skipDown;\r\n if (resizing && node.subGrid) { (node.subGrid as GridStack).onParentResize(); }// @ts-ignore\r\n this._extraDragRow = 0;// @ts-ignore\r\n this._updateContainerHeight();\r\n\r\n let target = event.target as GridItemHTMLElement;// @ts-ignore\r\n this._writePosAttr(target, node);\r\n if (this._gsEventHandler[event.type]) {\r\n this._gsEventHandler[event.type](event, target);\r\n }\r\n }\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(this: GridStack, 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) return;\r\n if (val) delete node.noMove; else node.noMove = true;\r\n this._prepareDragDropByNode(node); // init DD if need be, and adjust\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(this: GridStack, 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) return;\r\n if (val) delete node.noResize; else node.noResize = true;\r\n this._prepareDragDropByNode(node); // init DD if need be, and adjust\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(this: GridStack): GridStack {\r\n if (this.opts.staticGrid) return;\r\n this.enableMove(false);\r\n this.enableResize(false);// @ts-ignore\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(this: GridStack): GridStack {\r\n if (this.opts.staticGrid) return;\r\n this.enableMove(true);\r\n this.enableResize(true);// @ts-ignore\r\n this._triggerEvent('enable');\r\n return this;\r\n}\r\n\r\n/** Enables/disables widget moving. No-op for static grids. */\r\nGridStack.prototype.enableMove = function(this: GridStack, doEnable: boolean): GridStack {\r\n if (this.opts.staticGrid) return this; // can't move a static grid!\r\n this.opts.disableDrag = !doEnable; // FIRST before we update children as grid overrides #1658\r\n this.engine.nodes.forEach(n => this.movable(n.el, doEnable));\r\n return this;\r\n}\r\n\r\n/** Enables/disables widget resizing. No-op for static grids. */\r\nGridStack.prototype.enableResize = function(this: GridStack, doEnable: boolean): GridStack {\r\n if (this.opts.staticGrid) return this; // can't size a static grid!\r\n this.opts.disableResize = !doEnable; // FIRST before we update children as grid overrides #1658\r\n this.engine.nodes.forEach(n => this.resizable(n.el, doEnable));\r\n return this;\r\n}\r\n","/**\r\n * gridstack-ddi.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\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 /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n public remove(el: GridItemHTMLElement): GridStackDDI {\r\n return this; // no-op for static grids\r\n }\r\n}\r\n","/**\n * gridstack-engine.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\n\nimport { Utils } from './utils';\nimport { GridStackNode, ColumnOptions, GridStackPosition, GridStackMoveOpts } from './types';\n\nexport type onChangeCB = (nodes: GridStackNode[], removeDOM?: boolean) => void;\n/** options used for creations - similar to GridStackOptions */\nexport interface GridStackEngineOptions {\n column?: number;\n maxRow?: number;\n float?: boolean;\n nodes?: GridStackNode[];\n onChange?: onChangeCB;\n}\n\n/**\n * Defines the GridStack engine that does most no DOM grid manipulation.\n * See GridStack methods and vars for descriptions.\n *\n * NOTE: values should not be modified directly - call the main GridStack API instead\n */\nexport class GridStackEngine {\n public column: number;\n public maxRow: number;\n public nodes: GridStackNode[];\n public onChange: onChangeCB;\n public addedNodes: GridStackNode[] = [];\n public removedNodes: GridStackNode[] = [];\n public batchMode: boolean;\n /** @internal */\n private _float: boolean;\n /** @internal */\n private _prevFloat: boolean;\n /** @internal cached layouts of difference column count so we can restore ack (eg 12 -> 1 -> 12) */\n private _layouts?: Layout[][]; // maps column # to array of values nodes\n /** @internal true while we are resizing widgets during column resize to skip certain parts */\n private _inColumnResize: boolean;\n /** @internal true if we have some items locked */\n private _hasLocked: boolean;\n /** @internal unique global internal _id counter NOT starting at 0 */\n private static _idSeq = 1;\n\n public constructor(opts: GridStackEngineOptions = {}) {\n this.column = opts.column || 12;\n this.onChange = opts.onChange;\n this._float = opts.float;\n this.maxRow = opts.maxRow;\n this.nodes = opts.nodes || [];\n }\n\n public batchUpdate(): GridStackEngine {\n if (this.batchMode) return this;\n this.batchMode = true;\n this._prevFloat = this._float;\n this._float = true; // let things go anywhere for now... commit() will restore and possibly reposition\n this.saveInitial(); // since begin update (which is called multiple times) won't do this\n return this;\n }\n\n public commit(): GridStackEngine {\n if (!this.batchMode) return this;\n this.batchMode = false;\n this._float = this._prevFloat;\n delete this._prevFloat;\n return this._packNodes()\n ._notify();\n }\n\n // use entire row for hitting area (will use bottom reverse sorted first) if we not actively moving DOWN and didn't already skip\n private _useEntireRowArea(node: GridStackNode, nn: GridStackPosition): boolean {\n return !this.float && !this._hasLocked && (!node._moving || node._skipDown || nn.y <= node.y);\n }\n\n /** @internal fix collision on given 'node', going to given new location 'nn', with optional 'collide' node already found.\n * return true if we moved. */\n private _fixCollisions(node: GridStackNode, nn = node, collide?: GridStackNode, opt: GridStackMoveOpts = {}): boolean {\n this._sortNodes(-1); // from last to first, so recursive collision move items in the right order\n\n collide = collide || this.collide(node, nn); // REAL area collide for swap and skip if none...\n if (!collide) return false;\n\n // swap check: if we're actively moving in gravity mode, see if we collide with an object the same size\n if (node._moving && !opt.nested && !this.float) {\n if (this.swap(node, collide)) return true;\n }\n\n // during while() collisions MAKE SURE to check entire row so larger items don't leap frog small ones (push them all down starting last in grid)\n let area = nn;\n if (this._useEntireRowArea(node, nn)) {\n area = {x: 0, w: this.column, y: nn.y, h: nn.h};\n collide = this.collide(node, area, opt.skip); // force new hit\n }\n\n let didMove = false;\n let newOpt: GridStackMoveOpts = {nested: true, pack: false};\n while (collide = collide || this.collide(node, area, opt.skip)) { // could collide with more than 1 item... so repeat for each\n let moved: boolean;\n // if colliding with a locked item OR moving down with top gravity (and collide could move up) -> skip past the collide,\n // but remember that skip down so we only do this once (and push others otherwise).\n if (collide.locked || node._moving && !node._skipDown && nn.y > node.y && !this.float &&\n // can take space we had, or before where we're going\n (!this.collide(collide, {...collide, y: node.y}, node) || !this.collide(collide, {...collide, y: nn.y - collide.h}, node))) {\n node._skipDown = (node._skipDown || nn.y > node.y);\n moved = this.moveNode(node, {...nn, y: collide.y + collide.h, ...newOpt});\n if (collide.locked && moved) {\n Utils.copyPos(nn, node); // moving after lock become our new desired location\n } else if (!collide.locked && moved && opt.pack) {\n // we moved after and will pack: do it now and keep the original drop location, but past the old collide to see what else we might push way\n this._packNodes();\n nn.y = collide.y + collide.h;\n Utils.copyPos(node, nn);\n }\n didMove = didMove || moved;\n } else {\n // move collide down *after* where we will be, ignoring where we are now (don't collide with us)\n moved = this.moveNode(collide, {...collide, y: nn.y + nn.h, skip: node, ...newOpt});\n }\n if (!moved) { return didMove; } // break inf loop if we couldn't move after all (ex: maxRow, fixed)\n collide = undefined;\n }\n return didMove;\n }\n\n /** return the nodes that intercept the given node. Optionally a different area can be used, as well as a second node to skip */\n public collide(skip: GridStackNode, area = skip, skip2?: GridStackNode): GridStackNode {\n return this.nodes.find(n => n !== skip && n !== skip2 && Utils.isIntercepted(n, area));\n }\n public collideAll(skip: GridStackNode, area = skip, skip2?: GridStackNode): GridStackNode[] {\n return this.nodes.filter(n => n !== skip && n !== skip2 && Utils.isIntercepted(n, area));\n }\n\n /** does a pixel coverage collision, returning the node that has the most coverage that is >50% mid line */\n public collideCoverage(node: GridStackNode, o: GridStackMoveOpts, collides: GridStackNode[]): GridStackNode {\n if (!o.rect || !node._rect) return;\n let r0 = node._rect; // where started\n let r = {...o.rect}; // where we are\n\n // update dragged rect to show where it's coming from (above or below, etc...)\n if (r.y > r0.y) {\n r.h += r.y - r0.y;\n r.y = r0.y;\n } else {\n r.h += r0.y - r.y;\n }\n if (r.x > r0.x) {\n r.w += r.x - r0.x;\n r.x = r0.x;\n } else {\n r.w += r0.x - r.x;\n }\n\n let collide: GridStackNode;\n collides.forEach(n => {\n if (n.locked || !n._rect) return;\n let r2 = n._rect; // overlapping target\n let yOver = Number.MAX_VALUE, xOver = Number.MAX_VALUE, overMax = 0.5; // need >50%\n // depending on which side we started from, compute the overlap % of coverage\n // (ex: from above/below we only compute the max horizontal line coverage)\n if (r0.y < r2.y) { // from above\n yOver = ((r.y + r.h) - r2.y) / r2.h;\n } else if (r0.y+r0.h > r2.y+r2.h) { // from below\n yOver = ((r2.y + r2.h) - r.y) / r2.h;\n }\n if (r0.x < r2.x) { // from the left\n xOver = ((r.x + r.w) - r2.x) / r2.w;\n } else if (r0.x+r0.w > r2.x+r2.w) { // from the right\n xOver = ((r2.x + r2.w) - r.x) / r2.w;\n }\n let over = Math.min(xOver, yOver);\n if (over > overMax) {\n overMax = over;\n collide = n;\n }\n });\n return collide;\n }\n\n /** called to cache the nodes pixel rectangles used for collision detection during drag */\n public cacheRects(w: number, h: number, top: number, right: number, bottom: number, left: number): GridStackEngine\n {\n this.nodes.forEach(n =>\n n._rect = {\n y: n.y * h + top,\n x: n.x * w + left,\n w: n.w * w - left - right,\n h: n.h * h - top - bottom\n }\n );\n return this;\n }\n\n /** called to possibly swap between 2 nodes (same size or column, not locked, touching), returning true if successful */\n public swap(a: GridStackNode, b: GridStackNode): boolean {\n if (!b || b.locked || !a || a.locked) return false;\n\n function _doSwap(): true { // assumes a is before b IFF they have different height (put after rather than exact swap)\n let x = b.x, y = b.y;\n b.x = a.x; b.y = a.y; // b -> a position\n if (a.h != b.h) {\n a.x = x; a.y = b.y + b.h; // a -> goes after b\n } else if (a.w != b.w) {\n a.x = b.x + b.w; a.y = y; // a -> goes after b\n } else {\n a.x = x; a.y = y; // a -> old b position\n }\n a._dirty = b._dirty = true;\n return true;\n }\n let touching: boolean; // remember if we called it (vs undefined)\n\n // same size and same row or column, and touching\n if (a.w === b.w && a.h === b.h && (a.x === b.x || a.y === b.y) && (touching = Utils.isTouching(a, b)))\n return _doSwap();\n if (touching === false) return; // IFF ran test and fail, bail out\n\n // check for taking same columns (but different height) and touching\n if (a.w === b.w && a.x === b.x && (touching || (touching = Utils.isTouching(a, b)))) {\n if (b.y < a.y) { let t = a; a = b; b = t; } // swap a <-> b vars so a is first\n return _doSwap();\n }\n if (touching === false) return;\n\n // check if taking same row (but different width) and touching\n if (a.h === b.h && a.y === b.y && (touching || (touching = Utils.isTouching(a, b)))) {\n if (b.x < a.x) { let t = a; a = b; b = t; } // swap a <-> b vars so a is first\n return _doSwap();\n }\n return false;\n }\n\n public isAreaEmpty(x: number, y: number, w: number, h: number): boolean {\n let nn: GridStackNode = {x: x || 0, y: y || 0, w: w || 1, h: h || 1};\n return !this.collide(nn);\n }\n\n /** re-layout grid items to reclaim any empty space */\n public compact(): GridStackEngine {\n if (this.nodes.length === 0) return this;\n this.batchUpdate()\n ._sortNodes();\n let copyNodes = this.nodes;\n this.nodes = []; // pretend we have no nodes to conflict layout to start with...\n copyNodes.forEach(node => {\n if (!node.locked) {\n node.autoPosition = true;\n }\n this.addNode(node, false); // 'false' for add event trigger\n node._dirty = true; // will force attr update\n });\n return this.commit();\n }\n\n /** enable/disable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html) */\n public set float(val: boolean) {\n if (this._float === val) return;\n this._float = val || false;\n if (!val) {\n this._packNodes()._notify();\n }\n }\n\n /** float getter method */\n public get float(): boolean { return this._float || false; }\n\n /** @internal */\n private _sortNodes(dir?: -1 | 1): GridStackEngine {\n this.nodes = Utils.sort(this.nodes, dir, this.column);\n return this;\n }\n\n /** @internal called to top gravity pack the items back OR revert back to original Y positions when floating */\n private _packNodes(): GridStackEngine {\n if (this.batchMode) { return this; }\n this._sortNodes(); // first to last\n\n if (this.float) {\n // restore original Y pos\n this.nodes.forEach(n => {\n if (n._updating || n._orig === undefined || n.y === n._orig.y) return;\n let newY = n.y;\n while (newY > n._orig.y) {\n --newY;\n let collide = this.collide(n, {x: n.x, y: newY, w: n.w, h: n.h});\n if (!collide) {\n n._dirty = true;\n n.y = newY;\n }\n }\n });\n } else {\n // top gravity pack\n this.nodes.forEach((n, i) => {\n if (n.locked) return;\n while (n.y > 0) {\n let newY = i === 0 ? 0 : n.y - 1;\n let canBeMoved = i === 0 || !this.collide(n, {x: n.x, y: newY, w: n.w, h: n.h});\n if (!canBeMoved) break;\n // Note: must be dirty (from last position) for GridStack::OnChange CB to update positions\n // and move items back. The user 'change' CB should detect changes from the original\n // starting position instead.\n n._dirty = (n.y !== newY);\n n.y = newY;\n }\n });\n }\n return this;\n }\n\n /**\n * given a random node, makes sure it's coordinates/values are valid in the current grid\n * @param node to adjust\n * @param resizing if out of bound, resize down or move into the grid to fit ?\n */\n public prepareNode(node: GridStackNode, resizing?: boolean): GridStackNode {\n node = node || {};\n node._id = node._id || GridStackEngine._idSeq++;\n\n // if we're missing position, have the grid position us automatically (before we set them to 0,0)\n if (node.x === undefined || node.y === undefined || node.x === null || node.y === null) {\n node.autoPosition = true;\n }\n\n // assign defaults for missing required fields\n let defaults: GridStackNode = { x: 0, y: 0, w: 1, h: 1};\n Utils.defaults(node, defaults);\n\n if (!node.autoPosition) { delete node.autoPosition; }\n if (!node.noResize) { delete node.noResize; }\n if (!node.noMove) { delete node.noMove; }\n\n // check for NaN (in case messed up strings were passed. can't do parseInt() || defaults.x above as 0 is valid #)\n if (typeof node.x == 'string') { node.x = Number(node.x); }\n if (typeof node.y == 'string') { node.y = Number(node.y); }\n if (typeof node.w == 'string') { node.w = Number(node.w); }\n if (typeof node.h == 'string') { node.h = Number(node.h); }\n if (isNaN(node.x)) { node.x = defaults.x; node.autoPosition = true; }\n if (isNaN(node.y)) { node.y = defaults.y; node.autoPosition = true; }\n if (isNaN(node.w)) { node.w = defaults.w; }\n if (isNaN(node.h)) { node.h = defaults.h; }\n\n return this.nodeBoundFix(node, resizing);\n }\n\n /** part2 of preparing a node to fit inside our grid - checks for x,y from grid dimensions */\n public nodeBoundFix(node: GridStackNode, resizing?: boolean): GridStackNode {\n\n let before = node._orig || Utils.copyPos({}, node);\n\n if (node.maxW) { node.w = Math.min(node.w, node.maxW); }\n if (node.maxH) { node.h = Math.min(node.h, node.maxH); }\n if (node.minW && node.minW <= this.column) { node.w = Math.max(node.w, node.minW); }\n if (node.minH) { node.h = Math.max(node.h, node.minH); }\n\n if (node.w > this.column) {\n // if user loaded a larger than allowed widget for current # of columns,\n // remember it's full width so we can restore back (1 -> 12 column) #1655\n // IFF we're not in the middle of column resizing!\n if (this.column < 12 && !this._inColumnResize) {\n node.w = Math.min(12, node.w);\n this.cacheOneLayout(node, 12);\n }\n node.w = this.column;\n } else if (node.w < 1) {\n node.w = 1;\n }\n\n if (this.maxRow && node.h > this.maxRow) {\n node.h = this.maxRow;\n } else if (node.h < 1) {\n node.h = 1;\n }\n\n if (node.x < 0) {\n node.x = 0;\n }\n if (node.y < 0) {\n node.y = 0;\n }\n\n if (node.x + node.w > this.column) {\n if (resizing) {\n node.w = this.column - node.x;\n } else {\n node.x = this.column - node.w;\n }\n }\n if (this.maxRow && node.y + node.h > this.maxRow) {\n if (resizing) {\n node.h = this.maxRow - node.y;\n } else {\n node.y = this.maxRow - node.h;\n }\n }\n\n if (!Utils.samePos(node, before)) {\n node._dirty = true;\n }\n\n return node;\n }\n\n public getDirtyNodes(verify?: boolean): GridStackNode[] {\n // compare original x,y,w,h instead as _dirty can be a temporary state\n if (verify) {\n return this.nodes.filter(n => n._dirty && !Utils.samePos(n, n._orig));\n }\n return this.nodes.filter(n => n._dirty);\n }\n\n /** @internal call this to call onChange CB with dirty nodes */\n private _notify(nodes?: GridStackNode | GridStackNode[], removeDOM = true): GridStackEngine {\n if (this.batchMode) return this;\n nodes = (nodes === undefined ? [] : (Array.isArray(nodes) ? nodes : [nodes]) );\n let dirtyNodes = nodes.concat(this.getDirtyNodes());\n this.onChange && this.onChange(dirtyNodes, removeDOM);\n return this;\n }\n\n /** @internal remove dirty and last tried info */\n public cleanNodes(): GridStackEngine {\n if (this.batchMode) return this;\n this.nodes.forEach(n => {\n delete n._dirty;\n delete n._lastTried;\n });\n return this;\n }\n\n /** @internal called to save initial position/size to track real dirty state.\n * Note: should be called right after we call change event (so next API is can detect changes)\n * as well as right before we start move/resize/enter (so we can restore items to prev values) */\n public saveInitial(): GridStackEngine {\n this.nodes.forEach(n => {\n n._orig = Utils.copyPos({}, n);\n delete n._dirty;\n });\n this._hasLocked = this.nodes.some(n => n.locked);\n return this;\n }\n\n /** @internal restore all the nodes back to initial values (called when we leave) */\n public restoreInitial(): GridStackEngine {\n this.nodes.forEach(n => {\n if (Utils.samePos(n, n._orig)) return;\n Utils.copyPos(n, n._orig);\n n._dirty = true;\n });\n this._notify();\n return this;\n }\n\n /** call to add the given node to our list, fixing collision and re-packing */\n public addNode(node: GridStackNode, triggerAddEvent = false): GridStackNode {\n let dup = this.nodes.find(n => n._id === node._id);\n if (dup) return dup; // prevent inserting twice! return it instead.\n\n // skip prepareNode if we're in middle of column resize (not new) but do check for bounds!\n node = this._inColumnResize ? this.nodeBoundFix(node) : this.prepareNode(node);\n delete node._temporaryRemoved;\n delete node._removeDOM;\n\n if (node.autoPosition) {\n this._sortNodes();\n\n for (let i = 0;; ++i) {\n let x = i % this.column;\n let y = Math.floor(i / this.column);\n if (x + node.w > this.column) {\n continue;\n }\n let box = {x, y, w: node.w, h: node.h};\n if (!this.nodes.find(n => Utils.isIntercepted(box, n))) {\n node.x = x;\n node.y = y;\n delete node.autoPosition; // found our slot\n break;\n }\n }\n }\n\n this.nodes.push(node);\n if (triggerAddEvent) { this.addedNodes.push(node); }\n\n this._fixCollisions(node);\n if (!this.batchMode) { this._packNodes()._notify(); }\n return node;\n }\n\n public removeNode(node: GridStackNode, removeDOM = true, triggerEvent = false): GridStackEngine {\n if (!this.nodes.find(n => n === node)) {\n // TEST console.log(`Error: GridStackEngine.removeNode() node._id=${node._id} not found!`)\n return this;\n }\n if (triggerEvent) { // we wait until final drop to manually track removed items (rather than during drag)\n this.removedNodes.push(node);\n }\n if (removeDOM) node._removeDOM = true; // let CB remove actual HTML (used to set _id to null, but then we loose layout info)\n // don't use 'faster' .splice(findIndex(),1) in case node isn't in our list, or in multiple times.\n this.nodes = this.nodes.filter(n => n !== node);\n return this._packNodes()\n ._notify(node);\n }\n\n public removeAll(removeDOM = true): GridStackEngine {\n delete this._layouts;\n if (this.nodes.length === 0) return this;\n removeDOM && this.nodes.forEach(n => n._removeDOM = true); // let CB remove actual HTML (used to set _id to null, but then we loose layout info)\n this.removedNodes = this.nodes;\n this.nodes = [];\n return this._notify(this.removedNodes);\n }\n\n /** checks if item can be moved (layout constrain) vs moveNode(), returning true if was able to move.\n * In more complicated cases (maxRow) it will attempt at moving the item and fixing\n * others in a clone first, then apply those changes if still within specs. */\n public moveNodeCheck(node: GridStackNode, o: GridStackMoveOpts): boolean {\n // if (node.locked) return false;\n if (!this.changedPosConstrain(node, o)) return false;\n o.pack = true;\n\n // simpler case: move item directly...\n if (!this.maxRow/* && !this._hasLocked*/) {\n return this.moveNode(node, o);\n }\n\n // complex case: create a clone with NO maxRow (will check for out of bounds at the end)\n let clonedNode: GridStackNode;\n let clone = new GridStackEngine({\n column: this.column,\n float: this.float,\n nodes: this.nodes.map(n => {\n if (n === node) {\n clonedNode = {...n};\n return clonedNode;\n }\n return {...n};\n })\n });\n if (!clonedNode) return false;\n\n let canMove = clone.moveNode(clonedNode, o);\n // if maxRow make sure we are still valid size\n if (this.maxRow && canMove) {\n canMove = (clone.getRow() <= this.maxRow);\n // turns out we can't grow, then see if we can swap instead (ex: full grid) if we're not resizing\n if (!canMove && !o.resizing) {\n let collide = this.collide(node, o);\n if (collide && this.swap(node, collide)) {\n this._notify();\n return true;\n }\n }\n }\n if (!canMove) return false;\n\n // if clone was able to move, copy those mods over to us now instead of caller trying to do this all over!\n // Note: we can't use the list directly as elements and other parts point to actual node, so copy content\n clone.nodes.filter(n => n._dirty).forEach(c => {\n let n = this.nodes.find(a => a._id === c._id);\n if (!n) return;\n Utils.copyPos(n, c);\n n._dirty = true;\n });\n this._notify();\n return true;\n }\n\n /** return true if can fit in grid height constrain only (always true if no maxRow) */\n public willItFit(node: GridStackNode): boolean {\n delete node._willFitPos;\n if (!this.maxRow) return true;\n // create a clone with NO maxRow and check if still within size\n let clone = new GridStackEngine({\n column: this.column,\n float: this.float,\n nodes: this.nodes.map(n => {return {...n}})\n });\n let n = {...node}; // clone node so we don't mod any settings on it but have full autoPosition and min/max as well! #1687\n this.cleanupNode(n);\n delete n.el; delete n._id; delete n.content; delete n.grid;\n clone.addNode(n);\n if (clone.getRow() <= this.maxRow) {\n node._willFitPos = Utils.copyPos({}, n);\n return true;\n }\n return false;\n }\n\n /** true if x,y or w,h are different after clamping to min/max */\n public changedPosConstrain(node: GridStackNode, p: GridStackPosition): boolean {\n // make sure w,h are set\n p.w = p.w || node.w;\n p.h = p.h || node.h;\n if (node.x !== p.x || node.y !== p.y) return true;\n // check constrained w,h\n if (node.maxW) { p.w = Math.min(p.w, node.maxW); }\n if (node.maxH) { p.h = Math.min(p.h, node.maxH); }\n if (node.minW) { p.w = Math.max(p.w, node.minW); }\n if (node.minH) { p.h = Math.max(p.h, node.minH); }\n return (node.w !== p.w || node.h !== p.h);\n }\n\n /** return true if the passed in node was actually moved (checks for no-op and locked) */\n public moveNode(node: GridStackNode, o: GridStackMoveOpts): boolean {\n if (!node || /*node.locked ||*/ !o) return false;\n if (o.pack === undefined) o.pack = true;\n\n // constrain the passed in values and check if we're still changing our node\n if (typeof o.x !== 'number') { o.x = node.x; }\n if (typeof o.y !== 'number') { o.y = node.y; }\n if (typeof o.w !== 'number') { o.w = node.w; }\n if (typeof o.h !== 'number') { o.h = node.h; }\n let resizing = (node.w !== o.w || node.h !== o.h);\n let nn: GridStackNode = Utils.copyPos({}, node, true); // get min/max out first, then opt positions next\n Utils.copyPos(nn, o);\n nn = this.nodeBoundFix(nn, resizing);\n Utils.copyPos(o, nn);\n\n if (Utils.samePos(node, o)) return false;\n let prevPos: GridStackPosition = Utils.copyPos({}, node);\n\n // during while() collisions make sure to check entire row so larger items don't leap frog small ones (push them all down)\n let area = nn;\n // if (this._useEntireRowArea(node, nn)) {\n // area = {x: 0, w: this.column, y: nn.y, h: nn.h};\n // }\n\n // check if we will need to fix collision at our new location\n let collides = this.collideAll(node, area, o.skip);\n let needToMove = true;\n if (collides.length) {\n // now check to make sure we actually collided over 50% surface area while dragging\n let collide = node._moving && !o.nested ? this.collideCoverage(node, o, collides) : collides[0];\n if (collide) {\n needToMove = !this._fixCollisions(node, nn, collide, o); // check if already moved...\n } else {\n needToMove = false; // we didn't cover >50% for a move, skip...\n }\n }\n\n // now move (to the original ask vs the collision version which might differ) and repack things\n if (needToMove) {\n node._dirty = true;\n Utils.copyPos(node, nn);\n }\n if (o.pack) {\n this._packNodes()\n ._notify();\n }\n return !Utils.samePos(node, prevPos); // pack might have moved things back\n }\n\n public getRow(): number {\n return this.nodes.reduce((row, n) => Math.max(row, n.y + n.h), 0);\n }\n\n public beginUpdate(node: GridStackNode): GridStackEngine {\n if (!node._updating) {\n node._updating = true;\n delete node._skipDown;\n if (!this.batchMode) this.saveInitial();\n }\n return this;\n }\n\n public endUpdate(): GridStackEngine {\n let n = this.nodes.find(n => n._updating);\n if (n) {\n delete n._updating;\n delete n._skipDown;\n }\n return this;\n }\n\n /** saves a copy of the largest column layout (eg 12 even when rendering oneColumnMode, so we don't loose orig layout),\n * returning a list of widgets for serialization */\n public save(saveElement = true): GridStackNode[] {\n // use the highest layout for any saved info so we can have full detail on reload #1849\n let len = this._layouts?.length;\n let layout = len && this.column !== (len - 1) ? this._layouts[len - 1] : null;\n let list: GridStackNode[] = [];\n this._sortNodes();\n this.nodes.forEach(n => {\n let wl = layout?.find(l => l._id === n._id);\n let w: GridStackNode = {...n};\n // use layout info instead if set\n if (wl) { w.x = wl.x; w.y = wl.y; w.w = wl.w; }\n // delete internals\n for (let key in w) { if (key[0] === '_' || w[key] === null || w[key] === undefined ) delete w[key]; }\n delete w.grid;\n if (!saveElement) delete w.el;\n // delete default values (will be re-created on read)\n if (!w.autoPosition) delete w.autoPosition;\n if (!w.noResize) delete w.noResize;\n if (!w.noMove) delete w.noMove;\n if (!w.locked) delete w.locked;\n list.push(w);\n });\n return list;\n }\n\n /** @internal called whenever a node is added or moved - updates the cached layouts */\n public layoutsNodesChange(nodes: GridStackNode[]): GridStackEngine {\n if (!this._layouts || this._inColumnResize) return this;\n // remove smaller layouts - we will re-generate those on the fly... larger ones need to update\n this._layouts.forEach((layout, column) => {\n if (!layout || column === this.column) return this;\n if (column < this.column) {\n this._layouts[column] = undefined;\n }\n else {\n // we save the original x,y,w (h isn't cached) to see what actually changed to propagate better.\n // NOTE: we don't need to check against out of bound scaling/moving as that will be done when using those cache values. #1785\n let ratio = column / this.column;\n nodes.forEach(node => {\n if (!node._orig) return; // didn't change (newly added ?)\n let n = layout.find(l => l._id === node._id);\n if (!n) return; // no cache for new nodes. Will use those values.\n // Y changed, push down same amount\n // TODO: detect doing item 'swaps' will help instead of move (especially in 1 column mode)\n if (node.y !== node._orig.y) {\n n.y += (node.y - node._orig.y);\n }\n // X changed, scale from new position\n if (node.x !== node._orig.x) {\n n.x = Math.round(node.x * ratio);\n }\n // width changed, scale from new width\n if (node.w !== node._orig.w) {\n n.w = Math.round(node.w * ratio);\n }\n // ...height always carries over from cache\n });\n }\n });\n return this;\n }\n\n /**\n * @internal Called to scale the widget width & position up/down based on the column change.\n * Note we store previous layouts (especially original ones) to make it possible to go\n * from say 12 -> 1 -> 12 and get back to where we were.\n *\n * @param prevColumn previous number of columns\n * @param column new column number\n * @param nodes different sorted list (ex: DOM order) instead of current list\n * @param layout specify the type of re-layout that will happen (position, size, etc...).\n * Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column\n */\n public updateNodeWidths(prevColumn: number, column: number, nodes: GridStackNode[], layout: ColumnOptions = 'moveScale'): GridStackEngine {\n if (!this.nodes.length || !column || prevColumn === column) return this;\n\n // cache the current layout in case they want to go back (like 12 -> 1 -> 12) as it requires original data\n this.cacheLayout(this.nodes, prevColumn);\n this.batchUpdate(); // do this EARLY as it will call saveInitial() so we can detect where we started for _dirty and collision\n let newNodes: GridStackNode[] = [];\n\n // if we're going to 1 column and using DOM order rather than default sorting, then generate that layout\n let domOrder = false;\n if (column === 1 && nodes?.length) {\n domOrder = true;\n let top = 0;\n nodes.forEach(n => {\n n.x = 0;\n n.w = 1;\n n.y = Math.max(n.y, top);\n top = n.y + n.h;\n });\n newNodes = nodes;\n nodes = [];\n } else {\n nodes = Utils.sort(this.nodes, -1, prevColumn); // current column reverse sorting so we can insert last to front (limit collision)\n }\n\n // see if we have cached previous layout IFF we are going up in size (restore) otherwise always\n // generate next size down from where we are (looks more natural as you gradually size down).\n let cacheNodes: Layout[] = [];\n if (column > prevColumn) {\n cacheNodes = this._layouts[column] || [];\n // ...if not, start with the largest layout (if not already there) as down-scaling is more accurate\n // by pretending we came from that larger column by assigning those values as starting point\n let lastIndex = this._layouts.length - 1;\n if (!cacheNodes.length && prevColumn !== lastIndex && this._layouts[lastIndex]?.length) {\n prevColumn = lastIndex;\n this._layouts[lastIndex].forEach(cacheNode => {\n let n = nodes.find(n => n._id === cacheNode._id);\n if (n) {\n // still current, use cache info positions\n n.x = cacheNode.x;\n n.y = cacheNode.y;\n n.w = cacheNode.w;\n }\n });\n }\n }\n\n // if we found cache re-use those nodes that are still current\n cacheNodes.forEach(cacheNode => {\n let j = nodes.findIndex(n => n._id === cacheNode._id);\n if (j !== -1) {\n // still current, use cache info positions\n nodes[j].x = cacheNode.x;\n nodes[j].y = cacheNode.y;\n nodes[j].w = cacheNode.w;\n newNodes.push(nodes[j]);\n nodes.splice(j, 1);\n }\n });\n // ...and add any extra non-cached ones\n if (nodes.length) {\n if (typeof layout === 'function') {\n layout(column, prevColumn, newNodes, nodes);\n } else if (!domOrder) {\n let ratio = column / prevColumn;\n let move = (layout === 'move' || layout === 'moveScale');\n let scale = (layout === 'scale' || layout === 'moveScale');\n nodes.forEach(node => {\n // NOTE: x + w could be outside of the grid, but addNode() below will handle that\n node.x = (column === 1 ? 0 : (move ? Math.round(node.x * ratio) : Math.min(node.x, column - 1)));\n node.w = ((column === 1 || prevColumn === 1) ? 1 :\n scale ? (Math.round(node.w * ratio) || 1) : (Math.min(node.w, column)));\n newNodes.push(node);\n });\n nodes = [];\n }\n }\n\n // finally re-layout them in reverse order (to get correct placement)\n newNodes = Utils.sort(newNodes, -1, column);\n this._inColumnResize = true; // prevent cache update\n this.nodes = []; // pretend we have no nodes to start with (add() will use same structures) to simplify layout\n newNodes.forEach(node => {\n this.addNode(node, false); // 'false' for add event trigger\n delete node._orig; // make sure the commit doesn't try to restore things back to original\n });\n this.commit();\n delete this._inColumnResize;\n return this;\n }\n\n /**\n * call to cache the given layout internally to the given location so we can restore back when column changes size\n * @param nodes list of nodes\n * @param column corresponding column index to save it under\n * @param clear if true, will force other caches to be removed (default false)\n */\n public cacheLayout(nodes: GridStackNode[], column: number, clear = false): GridStackEngine {\n let copy: Layout[] = [];\n nodes.forEach((n, i) => {\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\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\n });\n this._layouts = clear ? [] : this._layouts || []; // use array to find larger quick\n this._layouts[column] = copy;\n return this;\n }\n\n /**\n * call to cache the given node layout internally to the given location so we can restore back when column changes size\n * @param node single node to cache\n * @param column corresponding column index to save it under\n */\n public cacheOneLayout(n: GridStackNode, column: number): GridStackEngine {\n n._id = n._id || GridStackEngine._idSeq++;\n let layout: Layout = {x: n.x, y: n.y, w: n.w, _id: n._id}\n this._layouts = this._layouts || [];\n this._layouts[column] = this._layouts[column] || [];\n let index = this._layouts[column].findIndex(l => l._id === n._id);\n index === -1 ? this._layouts[column].push(layout) : this._layouts[column][index] = layout;\n return this;\n }\n\n\n /** called to remove all internal values but the _id */\n public cleanupNode(node: GridStackNode): GridStackEngine {\n for (let prop in node) {\n if (prop[0] === '_' && prop !== '_id') delete node[prop];\n }\n return this;\n }\n}\n\n/** @internal class to store per column layout bare minimal info (subset of GridStackWidget) */\ninterface Layout {\n x: number;\n y: number;\n w: number;\n _id: number; // so we can find full node back\n}\n","/**\r\n * index-h5.ts 5.0 - everything you need for a Grid that uses HTML5 native drag&drop\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\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","/*!\r\n * GridStack 5.0\r\n * https://gridstackjs.com/\r\n *\r\n * Copyright (c) 2021 Alain Dumesny\r\n * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE\r\n */\r\nimport { GridStackEngine } from './gridstack-engine';\r\nimport { Utils, HeightData } from './utils';\r\nimport { ColumnOptions, GridItemHTMLElement, GridStackElement, GridStackEventHandlerCallback,\r\n GridStackNode, GridStackOptions, GridStackWidget, numberOrString, DDUIData, DDDragInOpt, GridStackPosition } 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\n/** list of possible events, or space separated list of them */\r\nexport type GridStackEvent = 'added' | 'change' | 'disable' | 'drag' | 'dragstart' | 'dragstop' | 'dropped' |\r\n 'enable' | 'removed' | 'resize' | 'resizestart' | 'resizestop' | string;\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 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 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, Utils.cloneDeep(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, Utils.cloneDeep(options));\r\n delete options.dragIn; delete options.dragInOptions; // only need to be done once (really a static global thing, not per grid)\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, but check if the passed 'parent' already has grid styling and should be used instead\r\n let el = parent;\r\n if (!parent.classList.contains('grid-stack')) {\r\n let doc = document.implementation.createHTMLDocument(''); // IE needs a param\r\n doc.body.innerHTML = `
`;\r\n el = doc.body.children[0] as HTMLElement;\r\n parent.appendChild(el);\r\n }\r\n\r\n // create grid class and load any children\r\n let grid = GridStack.init(opt, el);\r\n if (grid.opts.children) {\r\n let children = grid.opts.children;\r\n delete grid.opts.children;\r\n grid.load(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 _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 /** @internal extra row added when dragging at the bottom of the grid */\r\n private _extraDragRow = 0;\r\n /** @internal true if nested grid should get column count from our width */\r\n private _autoColumn?: 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 // 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 // flag only valid in sub-grids (handled by parent, not here)\r\n if (opts.column === 'auto') {\r\n delete opts.column;\r\n }\r\n\r\n // elements attributes override any passed options (like CSS style) - merge the two together\r\n let defaults: GridStackOptions = {...Utils.cloneDeep(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.getColumn();\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 parentGridItemEl.classList.add('grid-stack-nested');\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/column event to keep it square)\r\n this.cellHeight(undefined, false);\r\n } else {\r\n // append unit if any are set\r\n if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== GridDefaults.cellHeightUnit) {\r\n this.opts.cellHeight = this.opts.cellHeight + this.opts.cellHeightUnit;\r\n delete this.opts.cellHeightUnit;\r\n }\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.getColumn(),\r\n float: this.opts.float,\r\n maxRow: this.opts.maxRow,\r\n onChange: (cbNodes) => {\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 (!el) return;\r\n if (n._removeDOM) {\r\n if (el) el.remove();\r\n delete n._removeDOM;\r\n } else {\r\n this._writePosAttr(el, n);\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 => { // get dom elements (not nodes yet)\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.getColumn()\r\n });\r\n });\r\n elements.sort((a, b) => a.i - b.i).forEach(e => this._prepareElement(e.el));\r\n this.commit();\r\n }\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 // legacy support to appear 'per grid` options when really global.\r\n if (this.opts.dragIn) GridStack.setupDragIn(this.opts.dragIn, this.opts.dragInOptions);\r\n delete this.opts.dragIn;\r\n delete this.opts.dragInOptions;\r\n\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(''); // IE needs a param\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(''); // IE needs a param\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 = Utils.cloneDeep(options) || {}; // make a copy before we modify in case caller re-uses it\r\n Utils.defaults(options, domAttr);\r\n let node = 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\r\n // check if nested grid definition is present\r\n if (node.subGrid && !(node.subGrid as GridStack).el) { // see if there is a sub-grid to create too\r\n // if column special case it set, remember that flag and set default\r\n let autoColumn: boolean;\r\n let ops = node.subGrid as GridStackOptions;\r\n if (ops.column === 'auto') {\r\n ops.column = node.w;\r\n ops.disableOneColumnMode = true; // driven by parent\r\n autoColumn = true;\r\n }\r\n let content = node.el.querySelector('.grid-stack-item-content') as HTMLElement;\r\n node.subGrid = GridStack.addGrid(content, node.subGrid as GridStackOptions);\r\n if (autoColumn) { node.subGrid._autoColumn = true; }\r\n }\r\n\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n\r\n return el;\r\n }\r\n\r\n /**\r\n /**\r\n * saves the current layout returning a list of widgets for serialization which might include any nested grids.\r\n * @param saveContent if true (default) the latest html inside .grid-stack-content will be saved to GridStackWidget.content field, else it will\r\n * be removed.\r\n * @param saveGridOpt if true (default false), save the grid 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 instead.\r\n * @returns list of widgets or full grid option, including .children list of widgets\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 and nested grids\r\n list.forEach(n => {\r\n if (saveContent && 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 } else {\r\n if (!saveContent) { delete n.content; }\r\n // check for nested grid\r\n if (n.subGrid) {\r\n n.subGrid = (n.subGrid as GridStack).save(saveContent, true) as GridStackOptions;\r\n }\r\n }\r\n delete n.el;\r\n });\r\n\r\n // check if save entire grid options (needed for recursive) + children...\r\n if (saveGridOpt) {\r\n let o: GridStackOptions = Utils.cloneDeep(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) {\r\n o.cellHeight = 'auto'\r\n }\r\n if (this._autoColumn) {\r\n o.column = 'auto';\r\n delete o.disableOneColumnMode;\r\n }\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.getColumn()); // make copy before we mod/sort\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 }\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 let el = this.el.querySelector('.' + this.opts.itemClass) as HTMLElement;\r\n if (el) {\r\n let height = Utils.toNumber(el.getAttribute('gs-h'));\r\n return Math.round(el.offsetHeight / height);\r\n }\r\n // else do entire grid and # of rows (but doesn't work if min-height is the actual constrain)\r\n let rows = parseInt(this.el.getAttribute('gs-current-row'));\r\n return rows ? Math.round(this.el.getBoundingClientRect().height / rows) : this.opts.cellHeight as number;\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.getColumn();\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 (column < 1 || this.opts.column === column) return this;\r\n let oldColumn = this.getColumn();\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 => { // get dom elements in order\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 if (this._isAutoCellHeight) this.cellHeight();\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 as number;\r\n }\r\n\r\n /** returns an array of grid HTML elements (no placeholder) - used to iterate through our children in DOM order */\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, false); // permanently removes DD but don't set CSS class (we're going away)\r\n this.setAnimation(false);\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 this.el.removeAttribute('gs-current-row');\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: {top: number, left: number};\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.getColumn());\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 public on(name: GridStackEvent, callback: GridStackEventHandlerCallback): 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 === 'drag' || name === 'dragstart' || name === 'dragstop' || name === 'resizestart' || name === 'resize' || 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, updateClass = true): GridStack {\r\n if (this.opts.staticGrid === val) return this;\r\n this.opts.staticGrid = val;\r\n this._setupRemoveDrop();\r\n this._setupAcceptWidget();\r\n this.engine.nodes.forEach(n => this._prepareDragDropByNode(n)); // either delete or init Drag&drop\r\n if (updateClass) { 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(el, {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 = Utils.cloneDeep(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 .beginUpdate(n)\r\n .moveNode(n, m);\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() + this._extraDragRow; // checks for minRow already\r\n // check for css min height\r\n // Note: we don't handle %,rem correctly so comment out, beside we don't need need to create un-necessary\r\n // rows as the CSS will make us bigger than our set height if needed... not sure why we had this.\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 position x,y,w,h attributes back to element */\r\n private _writePosAttr(el: HTMLElement, n: GridStackPosition): GridStack {\r\n if (n.x !== undefined && n.x !== null) { el.setAttribute('gs-x', String(n.x)); }\r\n if (n.y !== undefined && n.y !== null) { el.setAttribute('gs-y', String(n.y)); }\r\n if (n.w) { el.setAttribute('gs-w', String(n.w)); }\r\n if (n.h) { el.setAttribute('gs-h', String(n.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);\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, or get our count from parent, 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 changedColumn = false;\r\n\r\n // see if we're nested and take our column count from our parent....\r\n if (this._autoColumn && this.opts._isNested) {\r\n if (this.opts.column !== this.opts._isNested.w) {\r\n changedColumn = true;\r\n this.column(this.opts._isNested.w, 'none');\r\n }\r\n } else {\r\n // else check for 1 column in/out behavior\r\n let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.minWidth;\r\n if ((this.opts.column === 1) !== oneColumn) {\r\n changedColumn = 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\r\n // make the cells content square again\r\n if (this._isAutoCellHeight) {\r\n if (!changedColumn && 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 column count 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 * call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.\r\n * Called during GridStack.init() as options, but can also be called directly (last param are cached) in case the toolbar\r\n * is dynamically create and needs to change later.\r\n * @param dragIn string selector (ex: '.sidebar .grid-stack-item')\r\n * @param dragInOptions options - see DDDragInOpt. (default: {revert: 'invalid', handle: '.grid-stack-item-content', scroll: false, appendTo: 'body'}\r\n **/\r\n public static setupDragIn(dragIn?: string, dragInOptions?: DDDragInOpt): void { /* implemented in gridstack-dd.ts */ }\r\n\r\n /**\r\n * Enables/Disables dragging by the user of specific grid element. If you want all items, and have it affect future items, use enableMove() instead. No-op for static grids.\r\n * IF you are looking to prevent an item from moving (due to being pushed around by another during collision) use locked property instead.\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 user resizing of specific grid element. If you want all items, and have it affect future items, use enableResize() instead. 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 public enableMove(doEnable: boolean): GridStack { return this }\r\n /**\r\n * Enables/disables widget resizing. No-op for static grids.\r\n */\r\n public enableResize(doEnable: boolean): GridStack { return this }\r\n\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 prepares the element for drag&drop **/\r\n public _prepareDragDropByNode(node: GridStackNode): GridStack { return this }\r\n /** @internal handles actual drag/resize start **/\r\n public _onStartMoving(el: GridItemHTMLElement, event: Event, ui: DDUIData, node: GridStackNode, cellWidth: number, cellHeight: number): void { return }\r\n /** @internal handles actual drag/resize **/\r\n public _dragOrResize(el: GridItemHTMLElement, event: Event, ui: DDUIData, node: GridStackNode, cellWidth: number, cellHeight: number): void { return }\r\n /** @internal called when a node leaves our area (mouse out or shape outside) **/\r\n public _leave(el: GridItemHTMLElement, helper?: GridItemHTMLElement): void { return }\r\n}\r\n","/**\n * dd-base-impl.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\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 && this._eventRegister && this._eventRegister[eventName])\n return this._eventRegister[eventName](event);\n }\n}\n\nexport interface HTMLElementExtendOpt {\n el: HTMLElement;\n option: T;\n updateOption(T): DDBaseImplement;\n}\n","/**\n * dd-draggable.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\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 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 #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', 'min-width'];\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.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 // immediately set external helper initial position to avoid flickering behavior and unnecessary looping in `_packNodes()`\n this._dragFollow(event);\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(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 // TODO: set all at once with style.cssText += ... ? https://stackoverflow.com/questions/3968593\n const rec = this.helper.getBoundingClientRect();\n const style = this.helper.style;\n style.pointerEvents = 'none';\n style['min-width'] = 0; // since we no longer relative to our parent and we don't resize anyway (normally 100/#column %)\n style.width = this.dragOffset.width + 'px';\n style.height = this.dragOffset.height + 'px';\n style.willChange = 'left, top';\n style.position = 'fixed'; // let us drag between grids by not clipping as parent .grid-stack is position: 'relative'\n style.left = rec.left + 'px';\n style.top = rec.top + 'px';\n style.transition = 'none'; // show up instantly\n setTimeout(() => {\n if (this.helper) {\n 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 (this.dragElementOriginStyle && (!node || !node._isAboutToRemove)) {\n DDDraggable.originStyleProp.forEach(prop => {\n this.helper.style[prop] = this.dragElementOriginStyle[prop] || null;\n });\n // show up instantly otherwise we animate to off the grid when switching back to 'absolute' from 'fixed'\n this.helper.style.transition = 'none';\n setTimeout(() => {\n if (this.helper) {\n this.helper.style.transition = this.dragElementOriginStyle['transition']; // recover animation\n }\n }, 0);\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.helper.style.position !== '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 ghost image to be created (which has wrong as 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 ghost 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 img.style.position = 'fixed'; // prevent unwanted scrollbar\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","/**\n * dd-droppable.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\n\nimport { DDDraggable } from './dd-draggable';\nimport { DDManager } from './dd-manager';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { DDUtils } from './dd-utils';\nimport { GridHTMLElement, GridStack } from '../gridstack';\nimport { GridItemHTMLElement } from '../types';\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\n// TEST let count = 0;\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 private static lastActive: DDDroppable;\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 this._removeLeaveCallbacks();\n this.disable(true);\n this.el.classList.remove('ui-droppable');\n this.el.classList.remove('ui-droppable-disabled');\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 // TEST console.log(`${count++} Enter ${(this.el as GridHTMLElement).gridstack.opts.id}`);\n if (!this._canDrop()) return;\n event.preventDefault();\n event.stopPropagation();\n\n // ignore multiple 'dragenter' as we go over existing items\n if (this.moving) return;\n this.moving = true;\n\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 // Update: removed that as it causes nested grids to no receive dragenter events when parent drags and sets this for #992. not seeing cursor flicker (chrome).\n // this.el.classList.add('ui-droppable-over');\n\n // make sure when we enter this, that the last one gets a leave to correctly cleanup as we don't always do\n if (DDDroppable.lastActive && DDDroppable.lastActive !== this) {\n DDDroppable.lastActive._dragLeave(event, true);\n }\n DDDroppable.lastActive = this;\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, forceLeave?: boolean): void {\n // TEST console.log(`${count++} Leave ${(this.el as GridHTMLElement).gridstack.opts.id}`);\n event.preventDefault();\n event.stopPropagation();\n\n // ignore leave events on our children (we get them when starting to drag our items)\n // but exclude nested grids since we would still be leaving ourself, \n // but don't handle leave if we're dragging a nested grid around\n if (!forceLeave) {\n let onChild = DDUtils.inside(event, this.el);\n let drag: GridItemHTMLElement = DDManager.dragElement.el;\n if (onChild && !drag.gridstackNode?.subGrid) { // dragging a nested grid ?\n let nestedEl = (this.el as GridHTMLElement).gridstack.engine.nodes.filter(n => n.subGrid).map(n => (n.subGrid as GridStack).el);\n onChild = !nestedEl.some(el => DDUtils.inside(event, el));\n }\n if (onChild) return;\n }\n\n if (this.moving) {\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 this._removeLeaveCallbacks();\n\n if (DDDroppable.lastActive === this) {\n delete DDDroppable.lastActive;\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 if (!this.moving) { return; }\n delete this.moving;\n this.el.removeEventListener('dragover', this._dragOver);\n this.el.removeEventListener('drop', this._drop);\n this.el.removeEventListener('dragleave', this._dragLeave);\n // Update: removed that as it causes nested grids to no receive dragenter events when parent drags and sets this for #992. not seeing cursor flicker (chrome).\n // this.el.classList.remove('ui-droppable-over');\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","/**\n * dd-elements.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\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","/**\n * dd-manager.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\n\nimport { DDDraggable } from './dd-draggable';\n\nexport class DDManager {\n static dragElement: DDDraggable;\n}\n","/**\n * dd-resizable-handle.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\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","/**\n * dd-resizable.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\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 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.getScrollElement(this.el);\n this.scrollY = this.scrollEl.scrollTop;\n this.scrolled = 0;\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 = 'absolute';\n this.el.style.opacity = '0.8';\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 += offsetX;\n } else if (dir.indexOf('w') > -1) {\n newRect.width -= offsetX;\n newRect.left += offsetX;\n }\n if (dir.indexOf('s') > -1) {\n newRect.height += offsetY;\n } else if (dir.indexOf('n') > -1) {\n newRect.height -= offsetY;\n newRect.top += offsetY\n }\n const constrain = this._constrainSize(newRect.width, newRect.height);\n if (Math.round(newRect.width) !== Math.round(constrain.width)) { // round to ignore slight round-off errors\n if (dir.indexOf('w') > -1) {\n newRect.left += newRect.width - constrain.width;\n }\n newRect.width = constrain.width;\n }\n if (Math.round(newRect.height) !== Math.round(constrain.height)) {\n if (dir.indexOf('n') > -1) {\n newRect.top += newRect.height - constrain.height;\n }\n newRect.height = constrain.height;\n }\n return newRect;\n }\n\n /** @internal constrain the size to the set min/max values */\n private _constrainSize(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","/**\n * dd-utils.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\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.appendChild(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\n /** returns true if event is inside the given element rectangle */\n // Note: Safari Mac has null event.relatedTarget which causes #1684 so check if DragEvent is inside the coordinates instead\n // this.el.contains(event.relatedTarget as HTMLElement)\n public static inside(e: MouseEvent, el: HTMLElement): boolean {\n // srcElement, toElement, target: all set to placeholder when leaving simple grid, so we can't use that (Chrome)\n let target: HTMLElement = e.relatedTarget || (e as any).fromElement;\n if (!target) {\n const { bottom, left, right, top } = el.getBoundingClientRect();\n return (e.x < right && e.x > left && e.y < bottom && e.y > top);\n }\n return el.contains(target);\n }\n}","/**\n * gridstack-dd-native.ts 5.0\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\n */\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","/**\r\n * utils.ts 5.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStackElement, GridStackNode, GridStackOptions, numberOrString, GridStackPosition, GridStackWidget } 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: GridStackPosition, b: GridStackPosition): boolean {\r\n return !(a.y >= b.y + b.h || a.y + a.h <= b.y || a.x + a.w <= b.x || a.x >= b.x + b.w);\r\n }\r\n\r\n /** returns true if a and b touch edges or corners */\r\n static isTouching(a: GridStackPosition, b: GridStackPosition): boolean {\r\n return Utils.isIntercepted(a, {x: b.x-0.5, y: b.y-0.5, w: b.w+1, h: b.h+1})\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 column = column || nodes.reduce((col, n) => Math.max(n.x + n.w, col), 0) || 12;\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 /** copies over b size & position (GridStackPosition), and possibly min/max as well */\r\n static copyPos(a: GridStackWidget, b: GridStackWidget, minMax = false): GridStackWidget {\r\n a.x = b.x;\r\n a.y = b.y;\r\n a.w = b.w;\r\n a.h = b.h;\r\n if (!minMax) return a;\r\n if (b.minW) a.minW = b.minW;\r\n if (b.minH) a.minH = b.minH;\r\n if (b.maxW) a.maxW = b.maxW;\r\n if (b.maxH) a.maxH = b.maxH;\r\n return a;\r\n }\r\n\r\n /** true if a and b has same size & position */\r\n static samePos(a: GridStackPosition, b: GridStackPosition): boolean {\r\n return a && b && a.x === b.x && a.y === b.y && a.w === b.w && a.h === b.h;\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 (key[0] === '_' || val === b[key]) {\r\n delete a[key]\r\n } else if (val && typeof val === 'object' && b[key] !== undefined) {\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 }\r\n }\r\n }\r\n\r\n /** return the closest parent (or itself) matching the given class */\r\n static closestByClass(el: HTMLElement, name: string): HTMLElement {\r\n while (el) {\r\n if (el.classList.contains(name)) return el;\r\n el = el.parentElement\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 returns the passed element if scrollable, else the closest parent that will, up to the entire document scrolling element */\r\n static getScrollElement(el?: HTMLElement): HTMLElement {\r\n if (!el) return document.scrollingElement as HTMLElement || document.documentElement; // IE support\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.getScrollElement(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.getScrollElement(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.getScrollElement(el);\r\n const height = scrollEl.clientHeight;\r\n // #1727 event.clientY is relative to viewport, so must compare this against position of scrollEl getBoundingClientRect().top\r\n // #1745 Special situation if scrollEl is document 'html': here browser spec states that\r\n // clientHeight is height of viewport, but getBoundingClientRect() is rectangle of html element;\r\n // this discrepancy arises because in reality scrollbar is attached to viewport, not html element itself.\r\n const offsetTop = (scrollEl === this.getScrollElement()) ? 0 : scrollEl.getBoundingClientRect().top;\r\n const pointerPosY = event.clientY - offsetTop;\r\n const top = pointerPosY < distance;\r\n const bottom = pointerPosY > 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: pointerPosY - distance});\r\n } else if (bottom) {\r\n scrollEl.scrollBy({ behavior: 'smooth', top: distance - (height - pointerPosY)});\r\n }\r\n }\r\n\r\n /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */\r\n static clone(obj: T): T {\r\n if (obj === null || obj === undefined || typeof(obj) !== 'object') {\r\n return obj;\r\n }\r\n // return Object.assign({}, obj);\r\n if (obj instanceof Array) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n return [...obj] as any;\r\n }\r\n return {...obj};\r\n }\r\n\r\n /**\r\n * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.\r\n * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.\r\n */\r\n static cloneDeep(obj: T): T {\r\n // return JSON.parse(JSON.stringify(obj)); // doesn't work with date format ?\r\n const ret = Utils.clone(obj);\r\n for (const key in ret) {\r\n // NOTE: we don't support function/circular dependencies so skip those properties for now...\r\n if (ret.hasOwnProperty(key) && typeof(ret[key]) === 'object' && key.substring(0, 2) !== '__' && !skipFields.find(k => k === key)) {\r\n ret[key] = Utils.cloneDeep(obj[key]);\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\n\r\n// list of fields we will skip during cloneDeep (nested objects, other internal)\r\nconst skipFields = ['_isNested', 'el', 'grid', 'subGrid', 'engine'];\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\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.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].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(930);\n"],"sourceRoot":""}