{ "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", "gridPos", "cellHeight", "cellWidth", "onDrag", "event", "helper", "rec", "getBoundingClientRect", "left", "top", "ui", "position", "_temporaryRemoved", "x", "Math", "max", "round", "y", "autoPosition", "engine", "nodeBoundFix", "willItFit", "off", "_willFitPos", "Utils", "copyPos", "_onStartMoving", "_dragOrResize", "accept", "canAccept", "selector", "matches", "maxRow", "n", "w", "h", "minW", "minH", "on", "_leave", "box", "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", "subGrid", "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", "cacheOneLayout", "verify", "samePos", "removeDOM", "dirtyNodes", "Array", "isArray", "concat", "getDirtyNodes", "some", "triggerAddEvent", "dup", "prepareNode", "_removeDOM", "floor", "_fixCollisions", "triggerEvent", "_layouts", "changedPosConstrain", "clonedNode", "clone", "map", "canMove", "c", "content", "prevPos", "collideAll", "needToMove", "collideCoverage", "reduce", "saveElement", "len", "layout", "list", "wl", "l", "key", "_ignoreLayoutsNodeChange", "ratio", "oldColumn", "cacheLayout", "cacheNodes", "lastIndex", "cacheNode", "j", "findIndex", "newNodes", "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", "style", "direction", "parentGridItemEl", "closestByClass", "_isNested", "_isAutoCellHeight", "_setStaticClass", "cbNodes", "_updateStyles", "elements", "getGridItems", "parseInt", "e", "_prepareElement", "setAnimation", "_updateWindowResizeEvent", "options", "elOrString", "getGridElement", "gridstack", "console", "error", "grids", "getGridElements", "parent", "contains", "doc", "implementation", "createHTMLDocument", "body", "innerHTML", "class", "children", "init", "load", "_placeholder", "placeholderChild", "createElement", "className", "arguments", "warn", "id", "addWidget", "domAttr", "_insertNotAppend", "prepend", "addGrid", "saveContent", "saveGridOpt", "save", "sub", "removeInternalAndSame", "addAndRemove", "items", "removed", "removeWidget", "item", "update", "forcePixel", "marginDiff", "data", "parseHeight", "unit", "clientWidth", "innerWidth", "compact", "domNodes", "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", "rows", "cssMinHeight", "getComputedStyle", "setAttribute", "String", "removeProperty", "same", "attrs", "resizeHandles", "hasOwnProperty", "classes", "oneColumn", "changedOneColumn", "_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", "pointerEvents", "willChange", "transition", "basePosition", "zIndex", "requestAnimationFrame", "clientX", "clientY", "match", "img", "dataTransfer", "setDragImage", "stopPropagation", "xformOffsetX", "xformOffsetY", "testEl", "addElStyles", "opacity", "testElPosition", "targetOffset", "DDDroppable", "_dragEnter", "_dragOver", "_dragLeave", "_drop", "_setupAccept", "moving", "_removeLeaveCallbacks", "_canDrop", "_ui", "relatedTarget", "out", "drop", "DDElement", "ddElement", "ddDraggable", "ddDroppable", "ddResizable", "updateOption", "DDResizable", "DDResizableHandle", "host", "_mouseDown", "_mouseMove", "_mouseUp", "_init", "userSelect", "mouseDownEvent", "s", "abs", "_showHandlers", "_hideHandlers", "newRect", "originalRect", "scrolled", "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", "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,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAmB,UAAID,IAEvBD,EAAgB,UAAIC,IARtB,CASGK,MAAM,WACT,M,6GCJA,eAEA,SACA,SAoBA,MAAsBC,UAAoB,EAAAC,aAGxC,aACE,OAAO,EAAAA,aAAaC,MAIf,OAAOC,GAKZ,OAJAC,KAAKC,UAAUF,EAAI,WAAWG,UAAUH,EAAI,WACxCA,EAAGI,sBACEJ,EAAGI,cAAcC,QAEnBJ,MAgQX,SAASK,EAAcN,EAAyBO,GAC9C,IAAIC,EAAOR,EAAKA,EAAGI,mBAAgBK,EAC9BD,GA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AAYU,EAAS0f,KAKtE,aAAgBhE,GACd,OAAIA,SAAqD,iBAAV,EACtCA,EAGLA,aAAenW,MAEV,IAAImW,GAEN,OAAP,UAAWA,GAOb,iBAAoBA,GAElB,MAAMmE,EAAMjnB,EAAM0N,MAAMoV,GACxB,IAAK,MAAMpU,KAAOuY,EAEZA,EAAIvN,eAAehL,IAA6B,iBAAduY,EAAIvY,IAA8C,OAAxBA,EAAIuM,UAAU,EAAG,KAAgBiM,EAAWjd,MAAK8N,GAAKA,IAAMrJ,MAC1HuY,EAAIvY,GAAO1O,EAAMmR,UAAU2R,EAAIpU,KAGnC,OAAOuY,GA1VX,UA+VA,MAAMC,EAAa,CAAC,YAAa,KAAM,OAAQ,UAAW,YCnZtDC,EAA2B,GCE3BC,EDCJ,SAASC,EAAoBC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqB3pB,IAAjB4pB,EACH,OAAOA,EAAa7qB,QAGrB,IAAIC,EAASwqB,EAAyBG,GAAY,CAGjD5qB,QAAS,IAOV,OAHA8qB,EAAoBF,GAAUG,KAAK9qB,EAAOD,QAASC,EAAQA,EAAOD,QAAS2qB,GAGpE1qB,EAAOD,QClBW2qB,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 4.3.1\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/**\r\n * Base class implementing common Grid drag'n'drop functionality, with domain specific subclass (h5 vs jq subclasses)\r\n */\r\nexport abstract class GridStackDD extends GridStackDDI {\r\n\r\n /** override to cast to correct type */\r\n static get(): GridStackDD {\r\n return GridStackDDI.get() as GridStackDD;\r\n }\r\n\r\n /** removes any drag&drop present (called during destroy) */\r\n public remove(el: GridItemHTMLElement): GridStackDD {\r\n this.draggable(el, 'destroy').resizable(el, 'destroy');\r\n if (el.gridstackNode) {\r\n delete el.gridstackNode._initDD; // reset our DD init flag\r\n }\r\n return this;\r\n }\r\n\r\n // APIs that must be implemented by subclasses to do actual darg/drop/resize called by GridStack code below\r\n\r\n public abstract resizable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDD;\r\n\r\n public abstract isResizable(el: HTMLElement): boolean;\r\n\r\n public abstract draggable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDD;\r\n\r\n public abstract dragIn(el: GridStackElement, opts: DDDragInOpt): GridStackDD;\r\n\r\n public abstract isDraggable(el: HTMLElement): boolean;\r\n\r\n public abstract droppable(el: GridItemHTMLElement, opts: DDOpts | DDDropOpt, key?: DDKey, value?: DDValue): GridStackDD;\r\n\r\n public abstract isDroppable(el: HTMLElement): boolean;\r\n\r\n public abstract on(el: GridItemHTMLElement, eventName: string, callback: DDCallback): GridStackDD;\r\n\r\n public abstract off(el: GridItemHTMLElement, eventName: string): GridStackDD;\r\n}\r\n\r\n/********************************************************************************\r\n * GridStack code that is doing drag&drop extracted here so main class is smaller\r\n * for static grid that don't do any of this work anyway. Saves about 10k.\r\n * TODO: no code hint in code below as this is so look at alternatives ?\r\n * https://www.typescriptlang.org/docs/handbook/declaration-merging.html\r\n * https://www.typescriptlang.org/docs/handbook/mixins.html\r\n ********************************************************************************/\r\n\r\n/** @internal called to add drag over 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 gridPos: MousePosition;\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 rec = helper.getBoundingClientRect();\r\n let left = rec.left - gridPos.left;\r\n let top = rec.top - gridPos.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 && node.grid === this) return true;\r\n if (!this.opts.acceptWidgets) 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 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 && 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 && 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 // get grid screen coordinates and cell dimensions\r\n let box = this.el.getBoundingClientRect();\r\n gridPos = {top: box.top, left: box.left};\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\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 let node = el.gridstackNode;\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 && 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 4.3.1\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 4.3.1\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 */\n private _layouts?: Layout[][]; // maps column # to array of values nodes\n /** @internal */\n private _ignoreLayoutsNodeChange: 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 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 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 if (this.column < 12) {\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 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: GridStackNode;\n if (dup = this.nodes.find(n => n._id === node._id)) return dup; // prevent inserting twice! return it instead.\n\n 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 triggerAddEvent && this.addedNodes.push(node);\n\n this._fixCollisions(node);\n this._packNodes()\n ._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._ignoreLayoutsNodeChange) 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.\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 let ratio = column / this.column;\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 oldColumn 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(oldColumn: number, column: number, nodes: GridStackNode[], layout: ColumnOptions = 'moveScale'): GridStackEngine {\n if (!this.nodes.length || oldColumn === 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, oldColumn);\n\n // if we're going to 1 column and using DOM order rather than default sorting, then generate that layout\n if (column === 1 && nodes && nodes.length) {\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 } else {\n nodes = Utils.sort(this.nodes, -1, oldColumn); // current column reverse sorting so we can insert last to front (limit collision)\n }\n\n // see if we have cached previous layout.\n let cacheNodes = this._layouts[column] || [];\n // if not AND we are going up in size start with the largest layout as down-scaling is more accurate\n let lastIndex = this._layouts.length - 1;\n if (cacheNodes.length === 0 && column > oldColumn && column < lastIndex) {\n cacheNodes = this._layouts[lastIndex] || [];\n if (cacheNodes.length) {\n // pretend we came from that larger column by assigning those values as starting point\n oldColumn = lastIndex;\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 }\n });\n cacheNodes = []; // we still don't have new column cached data... will generate from larger one.\n }\n }\n\n // if we found cache re-use those nodes that are still current\n let newNodes: GridStackNode[] = [];\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, oldColumn, newNodes, nodes);\n } else {\n let ratio = column / oldColumn;\n let move = (layout === 'move' || layout === 'moveScale');\n let scale = (layout === 'scale' || layout === 'moveScale');\n nodes.forEach(node => {\n node.x = (column === 1 ? 0 : (move ? Math.round(node.x * ratio) : Math.min(node.x, column - 1)));\n node.w = ((column === 1 || oldColumn === 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._ignoreLayoutsNodeChange = true;\n this.batchUpdate();\n this.nodes = []; // pretend we have no nodes to start with (we use same structures) to simplify layout\n newNodes.forEach(node => {\n this.addNode(node, false); // 'false' for add event trigger\n node._dirty = true; // force attr update\n }, this);\n this.commit();\n delete this._ignoreLayoutsNodeChange;\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 4.3.1 - 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 4.3.1\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\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();\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\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 // 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.opts.column;\r\n this.opts.column = 1;\r\n }\r\n\r\n if (this.opts.rtl === 'auto') {\r\n this.opts.rtl = (el.style.direction === 'rtl');\r\n }\r\n\r\n if (this.opts.rtl) {\r\n this.el.classList.add('grid-stack-rtl');\r\n }\r\n\r\n // check if we're been nested, and if so update our style and keep pointer around (used during save)\r\n let parentGridItemEl = Utils.closestByClass(this.el, GridDefaults.itemClass) as GridItemHTMLElement;\r\n if (parentGridItemEl && parentGridItemEl.gridstackNode) {\r\n this.opts._isNested = parentGridItemEl.gridstackNode;\r\n this.opts._isNested.subGrid = this;\r\n this.el.classList.add('grid-stack-nested');\r\n }\r\n\r\n this._isAutoCellHeight = (this.opts.cellHeight === 'auto');\r\n if (this._isAutoCellHeight || this.opts.cellHeight === 'initial') {\r\n // make the cell content square initially (will use resize/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.opts.column,\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 (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.opts.column\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();\r\n doc.body.innerHTML = els;\r\n el = doc.body.children[0] as HTMLElement;\r\n } else if (arguments.length === 0 || arguments.length === 1 && isGridStackWidget(els)) {\r\n let content = els ? (els as GridStackWidget).content || '' : '';\r\n options = els;\r\n let doc = document.implementation.createHTMLDocument();\r\n doc.body.innerHTML = `
${content}
`;\r\n el = doc.body.children[0] as HTMLElement;\r\n } else {\r\n el = els as HTMLElement;\r\n }\r\n\r\n // Tempting to initialize the passed in opt with default and valid values, but this break knockout demos\r\n // as the actual value are filled in when _prepareElement() calls el.getAttribute('gs-xyz) before adding the node.\r\n // So make sure we load any DOM attributes that are not specified in passed in options (which override)\r\n let domAttr = this._readAttr(el);\r\n options = 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 let content = node.el.querySelector('.grid-stack-item-content') as HTMLElement;\r\n node.subGrid = GridStack.addGrid(content, node.subGrid as GridStackOptions);\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) { o.cellHeight = 'auto' }\r\n Utils.removeInternalAndSame(o, GridDefaults);\r\n o.children = list;\r\n return o;\r\n }\r\n\r\n return list;\r\n }\r\n\r\n /**\r\n * load the widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.\r\n *\r\n * @param layout list of widgets definition to update/create\r\n * @param addAndRemove boolean (default true) or callback method can be passed to control if and how missing widgets can be added/removed, giving\r\n * the user control of insertion.\r\n *\r\n * @example\r\n * see http://gridstackjs.com/demo/serialization.html\r\n **/\r\n public load(layout: GridStackWidget[], addAndRemove: boolean | ((g: GridStack, w: GridStackWidget, add: boolean) => GridItemHTMLElement) = true): GridStack {\r\n let items = GridStack.Utils.sort([...layout], -1, this._prevColumn || this.opts.column); // 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 do entire grid and # of rows\r\n // or get first cell height ?\r\n // let el = this.el.querySelector('.' + this.opts.itemClass) as HTMLElement;\r\n // let height = Utils.toNumber(el.getAttribute('gs-h'));\r\n // return Math.round(el.offsetHeight / height);\r\n return Math.round(this.el.getBoundingClientRect().height) / parseInt(this.el.getAttribute('gs-current-row'));\r\n }\r\n\r\n /**\r\n * Update current cell height - see `GridStackOptions.cellHeight` for format.\r\n * This method rebuilds an internal CSS style sheet.\r\n * Note: You can expect performance issues if call this method too often.\r\n *\r\n * @param val the cell height. If not passed (undefined), cells content will be made square (match width minus margin),\r\n * if pass 0 the CSS will be generated by the application instead.\r\n * @param update (Optional) if false, styles will not be updated\r\n *\r\n * @example\r\n * grid.cellHeight(100); // same as 100px\r\n * grid.cellHeight('70px');\r\n * grid.cellHeight(grid.cellWidth() * 1.2);\r\n */\r\n public cellHeight(val?: numberOrString, update = true): GridStack {\r\n\r\n // if not called internally, check if we're changing mode\r\n if (update && val !== undefined) {\r\n if (this._isAutoCellHeight !== (val === 'auto')) {\r\n this._isAutoCellHeight = (val === 'auto');\r\n this._updateWindowResizeEvent();\r\n }\r\n }\r\n if (val === 'initial' || val === 'auto') { val = undefined; }\r\n\r\n // make item content be square\r\n if (val === undefined) {\r\n let marginDiff = - (this.opts.marginRight as number) - (this.opts.marginLeft as number)\r\n + (this.opts.marginTop as number) + (this.opts.marginBottom as number);\r\n val = this.cellWidth() + marginDiff;\r\n }\r\n\r\n let data = Utils.parseHeight(val);\r\n if (this.opts.cellHeightUnit === data.unit && this.opts.cellHeight === data.h) {\r\n return this;\r\n }\r\n this.opts.cellHeightUnit = data.unit;\r\n this.opts.cellHeight = data.h;\r\n\r\n if (update) {\r\n this._updateStyles(true, this.getRow()); // true = force re-create, for that # of rows\r\n }\r\n return this;\r\n }\r\n\r\n /** Gets current cell width. */\r\n public cellWidth(): number {\r\n return this._widthOrContainer() / this.opts.column;\r\n }\r\n /** return our expected width (or parent) for 1 column check */\r\n private _widthOrContainer(): number {\r\n // use `offsetWidth` or `clientWidth` (no scrollbar) ?\r\n // https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively\r\n return (this.el.clientWidth || this.el.parentElement.clientWidth || window.innerWidth);\r\n }\r\n\r\n /**\r\n * Finishes batch updates. Updates DOM nodes. You must call it after batchUpdate.\r\n */\r\n public commit(): GridStack {\r\n this.engine.commit();\r\n this._triggerRemoveEvent();\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n\r\n /** re-layout grid items to reclaim any empty space */\r\n public compact(): GridStack {\r\n this.engine.compact();\r\n this._triggerChangeEvent();\r\n return this;\r\n }\r\n\r\n /**\r\n * set the number of columns in the grid. Will update existing widgets to conform to new number of columns,\r\n * as well as cache the original layout so you can revert back to previous positions without loss.\r\n * Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11],\r\n * else you will need to generate correct CSS (see https://github.com/gridstack/gridstack.js#change-grid-columns)\r\n * @param column - Integer > 0 (default 12).\r\n * @param layout specify the type of re-layout that will happen (position, size, etc...).\r\n * Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column\r\n */\r\n public column(column: number, layout: ColumnOptions = 'moveScale'): GridStack {\r\n if (this.opts.column === column) return this;\r\n let oldColumn = this.opts.column;\r\n\r\n // if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)\r\n // then remember the original columns so we can restore.\r\n if (column === 1) {\r\n this._prevColumn = oldColumn;\r\n } else {\r\n delete this._prevColumn;\r\n }\r\n\r\n this.el.classList.remove('grid-stack-' + oldColumn);\r\n this.el.classList.add('grid-stack-' + column);\r\n this.opts.column = this.engine.column = column;\r\n\r\n // update the items now - see if the dom order nodes should be passed instead (else default to current list)\r\n let domNodes: GridStackNode[];\r\n if (column === 1 && this.opts.oneColumnModeDomSort) {\r\n domNodes = [];\r\n this.getGridItems().forEach(el => { // 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;\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.opts.column);\r\n let rowHeight = (box.height / parseInt(this.el.getAttribute('gs-current-row')));\r\n\r\n return {x: Math.floor(relativeLeft / columnWidth), y: Math.floor(relativeTop / rowHeight)};\r\n }\r\n\r\n /** returns the current number of rows, which will be at least `minRow` if set */\r\n public getRow(): number {\r\n return Math.max(this.engine.getRow(), this.opts.minRow);\r\n }\r\n\r\n /**\r\n * Checks if specified area is empty.\r\n * @param x the position x.\r\n * @param y the position y.\r\n * @param w the width of to check\r\n * @param h the height of to check\r\n */\r\n public isAreaEmpty(x: number, y: number, w: number, h: number): boolean {\r\n return this.engine.isAreaEmpty(x, y, w, h);\r\n }\r\n\r\n /**\r\n * If you add elements to your grid by hand, you have to tell gridstack afterwards to make them widgets.\r\n * If you want gridstack to add the elements for you, use `addWidget()` instead.\r\n * Makes the given element a widget and returns it.\r\n * @param els widget or single selector to convert.\r\n *\r\n * @example\r\n * let grid = GridStack.init();\r\n * grid.el.appendChild('
');\r\n * grid.makeWidget('#gsi-1');\r\n */\r\n public makeWidget(els: GridStackElement): GridItemHTMLElement {\r\n let el = GridStack.getElement(els);\r\n this._prepareElement(el, true);\r\n this._updateContainerHeight();\r\n this._triggerAddEvent();\r\n this._triggerChangeEvent();\r\n return el;\r\n }\r\n\r\n /**\r\n * Event handler that extracts our CustomEvent data out automatically for receiving custom\r\n * notifications (see doc for supported events)\r\n * @param name of the event (see possible values) or list of names space separated\r\n * @param callback function called with event and optional second/third param\r\n * (see README documentation for each signature).\r\n *\r\n * @example\r\n * grid.on('added', function(e, items) { log('added ', items)} );\r\n * or\r\n * grid.on('added removed change', function(e, items) { log(e.type, items)} );\r\n *\r\n * Note: in some cases it is the same as calling native handler and parsing the event.\r\n * grid.el.addEventListener('added', function(event) { log('added ', event.detail)} );\r\n *\r\n */\r\n 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 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, as well as check for auto cell height (square)\r\n */\r\n public onParentResize(): GridStack {\r\n if (!this.el || !this.el.clientWidth) return; // return if we're gone or no size yet (will get called again)\r\n let oneColumn = !this.opts.disableOneColumnMode && this.el.clientWidth <= this.opts.minWidth;\r\n let changedOneColumn = false;\r\n\r\n if ((this.opts.column === 1) !== oneColumn) {\r\n changedOneColumn = true;\r\n if (this.opts.animate) { this.setAnimation(false); } // 1 <-> 12 is too radical, turn off animation\r\n this.column(oneColumn ? 1 : this._prevColumn);\r\n if (this.opts.animate) { this.setAnimation(true); }\r\n }\r\n\r\n // make the cells content square again\r\n if (this._isAutoCellHeight) {\r\n if (!changedOneColumn && this.opts.cellHeightThrottle) {\r\n if (!this._cellHeightThrottle) {\r\n this._cellHeightThrottle = Utils.throttle(() => this.cellHeight(), this.opts.cellHeightThrottle);\r\n }\r\n this._cellHeightThrottle();\r\n } else {\r\n // immediate update if we've changed to/from oneColumn or have no threshold\r\n this.cellHeight();\r\n }\r\n }\r\n\r\n // finally update any nested grids\r\n this.engine.nodes.forEach(n => {\r\n if (n.subGrid) {(n.subGrid as GridStack).onParentResize()}\r\n });\r\n\r\n return this;\r\n }\r\n\r\n /** add or remove the window size event handler */\r\n private _updateWindowResizeEvent(forceRemove = false): GridStack {\r\n // only add event if we're not nested (parent will call us) and we're auto sizing cells or supporting oneColumn (i.e. doing work)\r\n const workTodo = (this._isAutoCellHeight || !this.opts.disableOneColumnMode) && !this.opts._isNested;\r\n\r\n if (!forceRemove && workTodo && !this._windowResizeBind) {\r\n this._windowResizeBind = this.onParentResize.bind(this); // so we can properly remove later\r\n window.addEventListener('resize', this._windowResizeBind);\r\n } else if ((forceRemove || !workTodo) && this._windowResizeBind) {\r\n window.removeEventListener('resize', this._windowResizeBind);\r\n delete this._windowResizeBind; // remove link to us so we can free\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** @internal convert a potential selector into actual element */\r\n public static getElement(els: GridStackElement = '.grid-stack-item'): GridItemHTMLElement { return Utils.getElement(els) }\r\n /** @internal */\r\n public static getElements(els: GridStackElement = '.grid-stack-item'): GridItemHTMLElement[] { return Utils.getElements(els) }\r\n /** @internal */\r\n public static getGridElement(els: GridStackElement): GridHTMLElement { return GridStack.getElement(els) }\r\n /** @internal */\r\n public static getGridElements(els: string): GridHTMLElement[] { return Utils.getElements(els) }\r\n\r\n /** @internal initialize margin top/bottom/left/right and units */\r\n private initMargin(): GridStack {\r\n\r\n let data: HeightData;\r\n let margin = 0;\r\n\r\n // support passing multiple values like CSS (ex: '5px 10px 0 20px')\r\n let margins: string[] = [];\r\n if (typeof this.opts.margin === 'string') {\r\n margins = this.opts.margin.split(' ')\r\n }\r\n if (margins.length === 2) { // top/bot, left/right like CSS\r\n this.opts.marginTop = this.opts.marginBottom = margins[0];\r\n this.opts.marginLeft = this.opts.marginRight = margins[1];\r\n } else if (margins.length === 4) { // Clockwise like CSS\r\n this.opts.marginTop = margins[0];\r\n this.opts.marginRight = margins[1];\r\n this.opts.marginBottom = margins[2];\r\n this.opts.marginLeft = margins[3];\r\n } else {\r\n data = Utils.parseHeight(this.opts.margin);\r\n this.opts.marginUnit = data.unit;\r\n margin = this.opts.margin = data.h;\r\n }\r\n\r\n // see if top/bottom/left/right need to be set as well\r\n if (this.opts.marginTop === undefined) {\r\n this.opts.marginTop = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginTop);\r\n this.opts.marginTop = data.h;\r\n delete this.opts.margin;\r\n }\r\n\r\n if (this.opts.marginBottom === undefined) {\r\n this.opts.marginBottom = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginBottom);\r\n this.opts.marginBottom = data.h;\r\n delete this.opts.margin;\r\n }\r\n\r\n if (this.opts.marginRight === undefined) {\r\n this.opts.marginRight = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginRight);\r\n this.opts.marginRight = data.h;\r\n delete this.opts.margin;\r\n }\r\n\r\n if (this.opts.marginLeft === undefined) {\r\n this.opts.marginLeft = margin;\r\n } else {\r\n data = Utils.parseHeight(this.opts.marginLeft);\r\n this.opts.marginLeft = data.h;\r\n delete this.opts.margin;\r\n }\r\n this.opts.marginUnit = data.unit; // in case side were spelled out, use those units instead...\r\n if (this.opts.marginTop === this.opts.marginBottom && this.opts.marginLeft === this.opts.marginRight && this.opts.marginTop === this.opts.marginRight) {\r\n this.opts.margin = this.opts.marginTop; // makes it easier to check for no-ops in setMargin()\r\n }\r\n return this;\r\n }\r\n\r\n /*\r\n * drag&drop empty stubs that will be implemented in gridstack-dd.ts for non static grid\r\n * so we don't incur the load unless needed.\r\n * NOTE: had to make those methods public in order to define them else as\r\n * GridStack.prototype._setupAcceptWidget = function()\r\n * maybe there is a better way ????\r\n */\r\n /* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n /**\r\n * 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 4.3.1\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 4.3.1\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 basePosition?: 'fixed' | 'absolute';\n start?: (event: Event, ui: DDUIData) => void;\n stop?: (event: Event) => void;\n drag?: (event: Event, ui: DDUIData) => void;\n}\n\ninterface DragOffset {\n left: number;\n top: number;\n width: number;\n height: number;\n offsetLeft: number;\n offsetTop: number;\n}\n\nexport class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt {\n public el: HTMLElement;\n public option: DDDraggableOpt;\n public helper: HTMLElement; // used by GridStackDDNative\n\n /** @internal */\n private dragOffset: DragOffset;\n /** @internal */\n private dragElementOriginStyle: Array;\n /** @internal */\n private dragFollowTimer: number;\n /** @internal */\n private dragEl: HTMLElement;\n /** @internal */\n private dragging = false;\n /** @internal */\n private paintTimer: number;\n /** @internal */\n private parentOriginStylePosition: string;\n /** @internal */\n private helperContainment: HTMLElement;\n /** @internal */\n private static basePosition: 'fixed' | 'absolute' = 'absolute';\n /** @internal #1541 can't have {passive: true} on Safari as otherwise it reverts animate back to old location on drop */\n private static dragEventListenerOption = true; // DDUtils.isEventSupportPassiveOption ? { capture: true, passive: true } : true;\n /** @internal */\n private static originStyleProp = ['transition', 'pointerEvents', 'position',\n 'left', 'top', 'opacity', 'zIndex', 'width', 'height', 'willChange'];\n\n constructor(el: HTMLElement, option: DDDraggableOpt = {}) {\n super();\n this.el = el;\n this.option = option;\n // get the element that is actually supposed to be dragged by\n let className = option.handle.substring(1);\n this.dragEl = el.classList.contains(className) ? el : el.querySelector(option.handle) || el;\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n this._dragStart = this._dragStart.bind(this);\n this._drag = this._drag.bind(this);\n this._dragEnd = this._dragEnd.bind(this);\n this.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 this.helper.style.pointerEvents = 'none';\n this.helper.style.width = this.dragOffset.width + 'px';\n this.helper.style.height = this.dragOffset.height + 'px';\n this.helper.style.willChange = 'left, top';\n this.helper.style.transition = 'none'; // show up instantly\n this.helper.style.position = this.option.basePosition || DDDraggable.basePosition;\n this.helper.style.zIndex = '1000';\n setTimeout(() => {\n if (this.helper) {\n this.helper.style.transition = null; // recover animation\n }\n }, 0);\n return this;\n }\n\n /** @internal */\n private _removeHelperStyle(): DDDraggable {\n // don't bother restoring styles if we're gonna remove anyway...\n let node = this.helper ? (this.helper as GridItemHTMLElement).gridstackNode : undefined;\n if (!node || !node._isAboutToRemove) {\n DDDraggable.originStyleProp.forEach(prop => {\n this.helper.style[prop] = this.dragElementOriginStyle[prop] || null;\n });\n }\n delete this.dragElementOriginStyle;\n return this;\n }\n\n /** @internal */\n private _dragFollow(event: DragEvent): void {\n if (this.paintTimer) {\n cancelAnimationFrame(this.paintTimer);\n }\n this.paintTimer = requestAnimationFrame(() => {\n delete this.paintTimer;\n const offset = this.dragOffset;\n let containmentRect = { left: 0, top: 0 };\n if (this.helper.style.position === 'absolute') {\n const { left, top } = this.helperContainment.getBoundingClientRect();\n containmentRect = { left, top };\n }\n this.helper.style.left = event.clientX + offset.offsetLeft - containmentRect.left + 'px';\n this.helper.style.top = event.clientY + offset.offsetTop - containmentRect.top + 'px';\n });\n }\n\n /** @internal */\n private _setupHelperContainmentStyle(): DDDraggable {\n this.helperContainment = this.helper.parentElement;\n if (this.option.basePosition !== 'fixed') {\n this.parentOriginStylePosition = this.helperContainment.style.position;\n if (window.getComputedStyle(this.helperContainment).position.match(/static/)) {\n this.helperContainment.style.position = 'relative';\n }\n }\n return this;\n }\n\n /** @internal prevent the default gost image to be created (which has wrongas we move the helper/element instead\n * (legacy jquery UI code updates the top/left of the item).\n * TODO: maybe use mouse event instead of HTML5 drag as we have to work around it anyway, or change code to not update\n * the actual grid-item but move the gost image around (and special case jq version) ?\n **/\n private _cancelDragGhost(e: DragEvent): DDDraggable {\n /* doesn't seem to do anything...\n let t = e.dataTransfer;\n t.effectAllowed = 'none';\n t.dropEffect = 'none';\n t.setData('text', '');\n */\n\n // NOTE: according to spec (and required by Safari see #1540) the image has to be visible in the browser (in dom and not hidden) so make it a 1px div\n let img = document.createElement('div');\n img.style.width = '1px';\n img.style.height = '1px';\n 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 4.3.1\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';\n\nexport interface DDDroppableOpt {\n accept?: string | ((el: HTMLElement) => boolean);\n drop?: (event: DragEvent, ui) => void;\n over?: (event: DragEvent, ui) => void;\n out?: (event: DragEvent, ui) => void;\n}\n\nexport class DDDroppable extends DDBaseImplement implements HTMLElementExtendOpt {\n\n public accept: (el: HTMLElement) => boolean;\n public el: HTMLElement;\n public option: DDDroppableOpt;\n\n /** @internal */\n private moving: boolean;\n\n constructor(el: HTMLElement, opts: DDDroppableOpt = {}) {\n super();\n this.el = el;\n this.option = opts;\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n this._dragEnter = this._dragEnter.bind(this);\n this._dragOver = this._dragOver.bind(this);\n this._dragLeave = this._dragLeave.bind(this);\n this._drop = this._drop.bind(this);\n\n this.el.classList.add('ui-droppable');\n this.el.addEventListener('dragenter', this._dragEnter);\n this._setupAccept();\n }\n\n public on(event: 'drop' | 'dropover' | 'dropout', callback: (event: DragEvent) => void): void {\n super.on(event, callback);\n }\n\n public off(event: 'drop' | 'dropover' | 'dropout'): void {\n super.off(event);\n }\n\n public enable(): void {\n if (!this.disabled) return;\n super.enable();\n this.el.classList.remove('ui-droppable-disabled');\n this.el.addEventListener('dragenter', this._dragEnter);\n }\n\n public disable(forDestroy=false): void {\n if (this.disabled) return;\n super.disable();\n if (!forDestroy) this.el.classList.add('ui-droppable-disabled');\n this.el.removeEventListener('dragenter', this._dragEnter);\n }\n\n public destroy(): void {\n if (this.moving) {\n this._removeLeaveCallbacks();\n } \n this.disable(true);\n this.el.classList.remove('ui-droppable');\n this.el.classList.remove('ui-droppable-disabled');\n delete this.moving;\n super.destroy();\n }\n\n public updateOption(opts: DDDroppableOpt): DDDroppable {\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n this._setupAccept();\n return this;\n }\n\n /** @internal called when the cursor enters our area - prepare for a possible drop and track leaving */\n private _dragEnter(event: DragEvent): void {\n if (!this._canDrop()) return;\n event.preventDefault();\n\n if (this.moving) return; // ignore multiple 'dragenter' as we go over existing items\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 this.el.classList.add('ui-droppable-over');\n }\n\n /** @internal called when an moving to drop item is being dragged over - do nothing but eat the event */\n private _dragOver(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n }\n\n /** @internal called when the item is leaving our area, stop tracking if we had moving item */\n private _dragLeave(event: DragEvent): void {\n\n // ignore leave events on our children (get when starting to drag our items)\n // Note: Safari Mac has null relatedTarget which causes #1684 so check if DragEvent is inside the grid instead\n if (!event.relatedTarget) {\n const { bottom, left, right, top } = this.el.getBoundingClientRect();\n if (event.x < right && event.x > left && event.y < bottom && event.y > top) return;\n } else if (this.el.contains(event.relatedTarget as HTMLElement)) return;\n\n this._removeLeaveCallbacks();\n if (this.moving) {\n event.preventDefault();\n const ev = DDUtils.initEvent(event, { target: this.el, type: 'dropout' });\n if (this.option.out) {\n this.option.out(ev, this._ui(DDManager.dragElement))\n }\n this.triggerEvent('dropout', ev);\n }\n delete this.moving;\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 delete this.moving;\n }\n\n /** @internal called to remove callbacks when leaving or dropping */\n private _removeLeaveCallbacks() {\n this.el.removeEventListener('dragleave', this._dragLeave);\n this.el.classList.remove('ui-droppable-over');\n if (this.moving) {\n this.el.removeEventListener('dragover', this._dragOver);\n this.el.removeEventListener('drop', this._drop);\n }\n // Note: this.moving is reset by callee of this routine to control the flow\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 4.3.1\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 4.3.1\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 4.3.1\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 4.3.1\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 basePosition?: 'fixed' | 'absolute';\n start?: (event: Event, ui: DDUIData) => void;\n stop?: (event: Event) => void;\n resize?: (event: Event, ui: DDUIData) => void;\n}\n\nexport class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt {\n\n // have to be public else complains for HTMLElementExtendOpt ?\n public el: HTMLElement;\n public option: DDResizableOpt;\n\n /** @internal */\n private handlers: DDResizableHandle[];\n /** @internal */\n private originalRect: Rect;\n /** @internal */\n private temporalRect: Rect;\n /** @internal */\n private scrollY: number;\n /** @internal */\n private scrolled: number;\n /** @internal */\n private scrollEl: HTMLElement;\n /** @internal */\n private startEvent: MouseEvent;\n /** @internal value saved in the same order as _originStyleProp[] */\n private elOriginStyleVal: string[];\n /** @internal */\n private parentOriginStylePosition: string;\n /** @internal */\n private static _originStyleProp = ['width', 'height', 'position', 'left', 'top', 'opacity', 'zIndex'];\n\n constructor(el: HTMLElement, opts: DDResizableOpt = {}) {\n super();\n this.el = el;\n this.option = opts;\n this.enable();\n this._setupAutoHide();\n this._setupHandlers();\n }\n\n public on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void {\n super.on(event, callback);\n }\n\n public off(event: 'resizestart' | 'resize' | 'resizestop'): void {\n super.off(event);\n }\n\n public enable(): void {\n super.enable();\n this.el.classList.add('ui-resizable');\n this.el.classList.remove('ui-resizable-disabled');\n }\n\n public disable(): void {\n super.disable();\n this.el.classList.add('ui-resizable-disabled');\n this.el.classList.remove('ui-resizable');\n }\n\n public destroy(): void {\n this._removeHandlers();\n if (this.option.autoHide) {\n this.el.removeEventListener('mouseover', this._showHandlers);\n this.el.removeEventListener('mouseout', this._hideHandlers);\n }\n this.el.classList.remove('ui-resizable');\n delete this.el;\n super.destroy();\n }\n\n public updateOption(opts: DDResizableOpt): DDResizable {\n let updateHandles = (opts.handles && opts.handles !== this.option.handles);\n let updateAutoHide = (opts.autoHide && opts.autoHide !== this.option.autoHide);\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n if (updateHandles) {\n this._removeHandlers();\n this._setupHandlers();\n }\n if (updateAutoHide) {\n this._setupAutoHide();\n }\n return this;\n }\n\n /** @internal */\n private _setupAutoHide(): DDResizable {\n if (this.option.autoHide) {\n this.el.classList.add('ui-resizable-autohide');\n // use mouseover/mouseout instead of mouseenter/mouseleave to get better performance;\n this.el.addEventListener('mouseover', this._showHandlers);\n this.el.addEventListener('mouseout', this._hideHandlers);\n } else {\n this.el.classList.remove('ui-resizable-autohide');\n this.el.removeEventListener('mouseover', this._showHandlers);\n this.el.removeEventListener('mouseout', this._hideHandlers);\n }\n return this;\n }\n\n /** @internal */\n private _showHandlers = () => {\n this.el.classList.remove('ui-resizable-autohide');\n }\n\n /** @internal */\n private _hideHandlers = () => {\n this.el.classList.add('ui-resizable-autohide');\n }\n\n /** @internal */\n private _setupHandlers(): DDResizable {\n let handlerDirection = this.option.handles || 'e,s,se';\n if (handlerDirection === 'all') {\n handlerDirection = 'n,e,s,w,se,sw,ne,nw';\n }\n this.handlers = handlerDirection.split(',')\n .map(dir => dir.trim())\n .map(dir => new DDResizableHandle(this.el, dir, {\n start: (event: MouseEvent) => {\n this._resizeStart(event);\n },\n stop: (event: MouseEvent) => {\n this._resizeStop(event);\n },\n move: (event: MouseEvent) => {\n this._resizing(event, dir);\n }\n }));\n return this;\n }\n\n /** @internal */\n private _resizeStart(event: MouseEvent): DDResizable {\n this.originalRect = this.el.getBoundingClientRect();\n this.scrollEl = Utils.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 = this.option.basePosition || 'absolute'; // or 'fixed'\n this.el.style.opacity = '0.8';\n this.el.style.zIndex = '1000';\n return this;\n }\n\n /** @internal */\n private _cleanHelper(): DDResizable {\n DDResizable._originStyleProp.forEach((prop, i) => {\n this.el.style[prop] = this.elOriginStyleVal[i] || null;\n });\n this.el.parentElement.style.position = this.parentOriginStylePosition || null;\n return this;\n }\n\n /** @internal */\n private _getChange(event: MouseEvent, dir: string): Rect {\n const oEvent = this.startEvent;\n const newRect = { // Note: originalRect is a complex object, not a simple Rect, so copy out.\n width: this.originalRect.width,\n height: this.originalRect.height + this.scrolled,\n left: this.originalRect.left,\n top: this.originalRect.top - this.scrolled\n };\n \n const offsetX = event.clientX - oEvent.clientX;\n const offsetY = event.clientY - oEvent.clientY;\n\n if (dir.indexOf('e') > -1) {\n newRect.width += 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 4.3.1\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 * gridstack-dd-native.ts 4.3.1\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 4.3.1\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 matching the given class */\r\n static closestByClass(el: HTMLElement, name: string): HTMLElement {\r\n\r\n while(el = el.parentElement) {\r\n if (el.classList.contains(name)) return el;\r\n }\r\n return null;\r\n }\r\n\r\n /** delay calling the given function for given delay, preventing new calls from happening while waiting */\r\n static throttle(func: () => void, delay: number): () => void {\r\n let isWaiting = false;\r\n return (...args) => {\r\n if (!isWaiting) {\r\n isWaiting = true;\r\n setTimeout(() => { func(...args); isWaiting = false; }, delay);\r\n }\r\n }\r\n }\r\n\r\n static removePositioningStyles(el: HTMLElement): void {\r\n let style = el.style;\r\n if (style.position) {\r\n style.removeProperty('position');\r\n }\r\n if (style.left) {\r\n style.removeProperty('left');\r\n }\r\n if (style.top) {\r\n style.removeProperty('top');\r\n }\r\n if (style.width) {\r\n style.removeProperty('width');\r\n }\r\n if (style.height) {\r\n style.removeProperty('height');\r\n }\r\n }\r\n\r\n /** @internal 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;\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": "" }