You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
25 KiB
JavaScript

/**
* Minified by jsDelivr using Terser v5.14.1.
* Original file: /npm/gridstack@6.0.1/dist/gridstack.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),__exportStar=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||e.hasOwnProperty(i)||__createBinding(e,t,i)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GridStack=void 0;
/*!
* GridStack 6.0.1
* https://gridstackjs.com/
*
* Copyright (c) 2021-2022 Alain Dumesny
* see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
*/
const gridstack_engine_1=require("./gridstack-engine"),utils_1=require("./utils");__exportStar(require("./types"),exports),__exportStar(require("./utils"),exports),__exportStar(require("./gridstack-engine"),exports);const GridDefaults={column:12,minRow:0,maxRow:0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,styleInHead:!1,cellHeight:"auto",cellHeightThrottle:100,margin:10,auto:!0,oneColumnSize:768,float:!1,staticGrid:!1,animate:!0,alwaysShowResizeHandle:"mobile",resizable:{handles:"se"},draggable:{handle:".grid-stack-item-content",appendTo:"body"},disableDrag:!1,disableResize:!1,rtl:"auto",removable:!1,removableOptions:{accept:".grid-stack-item"},marginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:!1,oneColumnModeDomSort:!1};class GridStack{constructor(t,e={}){this._gsEventHandler={},this._extraDragRow=0,this.el=t,(e=e||{}).row&&(e.minRow=e.maxRow=e.row,delete e.row);let i=utils_1.Utils.toNumber(t.getAttribute("gs-row"));"auto"===e.column&&delete e.column;let s=e;void 0!==s.minWidth&&(e.oneColumnSize=e.oneColumnSize||s.minWidth,delete s.minWidth),void 0!==e.alwaysShowResizeHandle&&(e._alwaysShowResizeHandle=e.alwaysShowResizeHandle);let r=Object.assign(Object.assign({},utils_1.Utils.cloneDeep(GridDefaults)),{column:utils_1.Utils.toNumber(t.getAttribute("gs-column"))||GridDefaults.column,minRow:i||(utils_1.Utils.toNumber(t.getAttribute("gs-min-row"))||GridDefaults.minRow),maxRow:i||(utils_1.Utils.toNumber(t.getAttribute("gs-max-row"))||GridDefaults.maxRow),staticGrid:utils_1.Utils.toBool(t.getAttribute("gs-static"))||GridDefaults.staticGrid,_styleSheetClass:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),draggable:{handle:(e.handleClass?"."+e.handleClass:e.handle?e.handle:"")||GridDefaults.draggable.handle},removableOptions:{accept:e.itemClass?"."+e.itemClass:GridDefaults.removableOptions.accept}});t.getAttribute("gs-animate")&&(r.animate=utils_1.Utils.toBool(t.getAttribute("gs-animate"))),this.opts=utils_1.Utils.defaults(e,r),e=null,this._initMargin(),1!==this.opts.column&&!this.opts.disableOneColumnMode&&this._widthOrContainer()<=this.opts.oneColumnSize&&(this._prevColumn=this.getColumn(),this.opts.column=1),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===t.style.direction),this.opts.rtl&&this.el.classList.add("grid-stack-rtl");let n=utils_1.Utils.closestByClass(this.el,GridDefaults.itemClass);n&&n.gridstackNode&&(this.opts._isNested=n.gridstackNode,this.opts._isNested.subGrid=this,n.classList.add("grid-stack-nested"),this.el.classList.add("grid-stack-nested")),this._isAutoCellHeight="auto"===this.opts.cellHeight,this._isAutoCellHeight||"initial"===this.opts.cellHeight?this.cellHeight(void 0,!1):("number"==typeof this.opts.cellHeight&&this.opts.cellHeightUnit&&this.opts.cellHeightUnit!==GridDefaults.cellHeightUnit&&(this.opts.cellHeight=this.opts.cellHeight+this.opts.cellHeightUnit,delete this.opts.cellHeightUnit),this.cellHeight(this.opts.cellHeight,!1)),"mobile"===this.opts.alwaysShowResizeHandle&&(this.opts.alwaysShowResizeHandle=dd_touch_1.isTouch),this.el.classList.add(this.opts._styleSheetClass),this._setStaticClass();let l=this.opts.engineClass||GridStack.engineClass||gridstack_engine_1.GridStackEngine;if(this.engine=new l({column:this.getColumn(),float:this.opts.float,maxRow:this.opts.maxRow,onChange:t=>{let e=0;this.engine.nodes.forEach((t=>{e=Math.max(e,t.y+t.h)})),t.forEach((t=>{let e=t.el;e&&(t._removeDOM?(e&&e.remove(),delete t._removeDOM):this._writePosAttr(e,t))})),this._updateStyles(!1,e)}}),this.opts.auto){this.batchUpdate();let t=[];this.getGridItems().forEach((e=>{let i=parseInt(e.getAttribute("gs-x")),s=parseInt(e.getAttribute("gs-y"));t.push({el:e,i:(Number.isNaN(i)?1e3:i)+(Number.isNaN(s)?1e3:s)*this.getColumn()})})),t.sort(((t,e)=>t.i-e.i)).forEach((t=>this._prepareElement(t.el))),this.batchUpdate(!1)}this.setAnimation(this.opts.animate),this._updateStyles(),12!=this.opts.column&&this.el.classList.add("grid-stack-"+this.opts.column),this.opts.dragIn&&GridStack.setupDragIn(this.opts.dragIn,this
//# sourceMappingURL=/sm/534d08a27666919c65a933b55352892bab1335d9819a47d05bd82d2a52b8daf3.map