gridstack 8.0.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/dist/dd-base-impl.d.ts +1 -1
- package/dist/dd-base-impl.js +1 -1
- package/dist/dd-base-impl.js.map +1 -1
- package/dist/dd-draggable.d.ts +3 -2
- package/dist/dd-draggable.js +9 -8
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +1 -1
- package/dist/dd-droppable.js +1 -1
- package/dist/dd-droppable.js.map +1 -1
- package/dist/dd-element.d.ts +1 -1
- package/dist/dd-element.js +1 -1
- package/dist/dd-element.js.map +1 -1
- package/dist/dd-gridstack.d.ts +1 -1
- package/dist/dd-gridstack.js +1 -1
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +1 -1
- package/dist/dd-manager.js +1 -1
- package/dist/dd-manager.js.map +1 -1
- package/dist/dd-resizable-handle.d.ts +1 -1
- package/dist/dd-resizable-handle.js +1 -1
- package/dist/dd-resizable-handle.js.map +1 -1
- package/dist/dd-resizable.d.ts +1 -1
- package/dist/dd-resizable.js +1 -1
- package/dist/dd-resizable.js.map +1 -1
- package/dist/dd-touch.d.ts +1 -1
- package/dist/dd-touch.js +1 -1
- package/dist/dd-touch.js.map +1 -1
- package/dist/es5/dd-base-impl.d.ts +1 -1
- package/dist/es5/dd-base-impl.js +1 -1
- package/dist/es5/dd-base-impl.js.map +1 -1
- package/dist/es5/dd-draggable.d.ts +3 -2
- package/dist/es5/dd-draggable.js +9 -8
- package/dist/es5/dd-draggable.js.map +1 -1
- package/dist/es5/dd-droppable.d.ts +1 -1
- package/dist/es5/dd-droppable.js +1 -1
- package/dist/es5/dd-droppable.js.map +1 -1
- package/dist/es5/dd-element.d.ts +1 -1
- package/dist/es5/dd-element.js +1 -1
- package/dist/es5/dd-element.js.map +1 -1
- package/dist/es5/dd-gridstack.d.ts +1 -1
- package/dist/es5/dd-gridstack.js +1 -1
- package/dist/es5/dd-gridstack.js.map +1 -1
- package/dist/es5/dd-manager.d.ts +1 -1
- package/dist/es5/dd-manager.js +1 -1
- package/dist/es5/dd-manager.js.map +1 -1
- package/dist/es5/dd-resizable-handle.d.ts +1 -1
- package/dist/es5/dd-resizable-handle.js +1 -1
- package/dist/es5/dd-resizable-handle.js.map +1 -1
- package/dist/es5/dd-resizable.d.ts +1 -1
- package/dist/es5/dd-resizable.js +1 -1
- package/dist/es5/dd-resizable.js.map +1 -1
- package/dist/es5/dd-touch.d.ts +1 -1
- package/dist/es5/dd-touch.js +1 -1
- package/dist/es5/dd-touch.js.map +1 -1
- package/dist/es5/gridstack-all.js +1 -1
- package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/es5/gridstack-all.js.map +1 -1
- package/dist/es5/gridstack-engine.d.ts +1 -1
- package/dist/es5/gridstack-engine.js +1 -1
- package/dist/es5/gridstack-engine.js.map +1 -1
- package/dist/es5/gridstack-poly.js +1 -1
- package/dist/es5/gridstack.d.ts +3 -3
- package/dist/es5/gridstack.js +4 -13
- package/dist/es5/gridstack.js.map +1 -1
- package/dist/es5/types.d.ts +5 -3
- package/dist/es5/types.js +1 -1
- package/dist/es5/types.js.map +1 -1
- package/dist/es5/utils.d.ts +3 -3
- package/dist/es5/utils.js +12 -10
- package/dist/es5/utils.js.map +1 -1
- package/dist/gridstack-all.js +1 -1
- package/dist/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/gridstack-all.js.map +1 -1
- package/dist/gridstack-engine.d.ts +1 -1
- package/dist/gridstack-engine.js +1 -1
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack-extra.css +180 -240
- package/dist/gridstack-extra.min.css +1 -1
- package/dist/gridstack.css +95 -118
- package/dist/gridstack.d.ts +3 -3
- package/dist/gridstack.js +4 -13
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/ng/gridstack-item.component.d.ts +1 -1
- package/dist/ng/gridstack-item.component.js +1 -1
- package/dist/ng/gridstack.component.d.ts +1 -1
- package/dist/ng/gridstack.component.js +1 -1
- package/dist/src/gridstack-extra.scss +9 -11
- package/dist/src/gridstack.scss +108 -97
- package/dist/types.d.ts +5 -3
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +12 -10
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +7 -0
- package/doc/README.md +5 -4
- package/package.json +1 -1
- package/dist_save/angular/README.md +0 -94
- package/dist_save/angular/gridstack-item.component.ts +0 -72
- package/dist_save/angular/gridstack.component.ts +0 -199
- package/dist_save/dd-base-impl.d.ts +0 -20
- package/dist_save/dd-base-impl.js +0 -36
- package/dist_save/dd-base-impl.js.map +0 -1
- package/dist_save/dd-draggable.d.ts +0 -28
- package/dist_save/dd-draggable.js +0 -343
- package/dist_save/dd-draggable.js.map +0 -1
- package/dist_save/dd-droppable.d.ts +0 -26
- package/dist_save/dd-droppable.js +0 -149
- package/dist_save/dd-droppable.js.map +0 -1
- package/dist_save/dd-element.d.ts +0 -27
- package/dist_save/dd-element.js +0 -95
- package/dist_save/dd-element.js.map +0 -1
- package/dist_save/dd-gridstack.d.ts +0 -34
- package/dist_save/dd-gridstack.js +0 -125
- package/dist_save/dd-gridstack.js.map +0 -1
- package/dist_save/dd-manager.d.ts +0 -22
- package/dist_save/dd-manager.js +0 -14
- package/dist_save/dd-manager.js.map +0 -1
- package/dist_save/dd-resizable-handle.d.ts +0 -14
- package/dist_save/dd-resizable-handle.js +0 -106
- package/dist_save/dd-resizable-handle.js.map +0 -1
- package/dist_save/dd-resizable.d.ts +0 -28
- package/dist_save/dd-resizable.js +0 -294
- package/dist_save/dd-resizable.js.map +0 -1
- package/dist_save/dd-touch.d.ts +0 -33
- package/dist_save/dd-touch.js +0 -183
- package/dist_save/dd-touch.js.map +0 -1
- package/dist_save/es5/dd-base-impl.d.ts +0 -20
- package/dist_save/es5/dd-base-impl.js +0 -41
- package/dist_save/es5/dd-base-impl.js.map +0 -1
- package/dist_save/es5/dd-draggable.d.ts +0 -28
- package/dist_save/es5/dd-draggable.js +0 -366
- package/dist_save/es5/dd-draggable.js.map +0 -1
- package/dist_save/es5/dd-droppable.d.ts +0 -26
- package/dist_save/es5/dd-droppable.js +0 -180
- package/dist_save/es5/dd-droppable.js.map +0 -1
- package/dist_save/es5/dd-element.d.ts +0 -27
- package/dist_save/es5/dd-element.js +0 -96
- package/dist_save/es5/dd-element.js.map +0 -1
- package/dist_save/es5/dd-gridstack.d.ts +0 -34
- package/dist_save/es5/dd-gridstack.js +0 -145
- package/dist_save/es5/dd-gridstack.js.map +0 -1
- package/dist_save/es5/dd-manager.d.ts +0 -22
- package/dist_save/es5/dd-manager.js +0 -17
- package/dist_save/es5/dd-manager.js.map +0 -1
- package/dist_save/es5/dd-resizable-handle.d.ts +0 -14
- package/dist_save/es5/dd-resizable-handle.js +0 -107
- package/dist_save/es5/dd-resizable-handle.js.map +0 -1
- package/dist_save/es5/dd-resizable.d.ts +0 -28
- package/dist_save/es5/dd-resizable.js +0 -316
- package/dist_save/es5/dd-resizable.js.map +0 -1
- package/dist_save/es5/dd-touch.d.ts +0 -33
- package/dist_save/es5/dd-touch.js +0 -186
- package/dist_save/es5/dd-touch.js.map +0 -1
- package/dist_save/es5/gridstack-all.js +0 -3
- package/dist_save/es5/gridstack-all.js.LICENSE.txt +0 -7
- package/dist_save/es5/gridstack-all.js.map +0 -1
- package/dist_save/es5/gridstack-engine.d.ts +0 -102
- package/dist_save/es5/gridstack-engine.js +0 -997
- package/dist_save/es5/gridstack-engine.js.map +0 -1
- package/dist_save/es5/gridstack-poly.js +0 -356
- package/dist_save/es5/gridstack.d.ts +0 -376
- package/dist_save/es5/gridstack.js +0 -2238
- package/dist_save/es5/gridstack.js.map +0 -1
- package/dist_save/es5/types.d.ts +0 -284
- package/dist_save/es5/types.js +0 -36
- package/dist_save/es5/types.js.map +0 -1
- package/dist_save/es5/utils.d.ts +0 -95
- package/dist_save/es5/utils.js +0 -590
- package/dist_save/es5/utils.js.map +0 -1
- package/dist_save/gridstack-all.js +0 -3
- package/dist_save/gridstack-all.js.LICENSE.txt +0 -7
- package/dist_save/gridstack-all.js.map +0 -1
- package/dist_save/gridstack-engine.d.ts +0 -102
- package/dist_save/gridstack-engine.js +0 -956
- package/dist_save/gridstack-engine.js.map +0 -1
- package/dist_save/gridstack-extra.css +0 -433
- package/dist_save/gridstack-extra.min.css +0 -1
- package/dist_save/gridstack.css +0 -226
- package/dist_save/gridstack.d.ts +0 -376
- package/dist_save/gridstack.js +0 -2162
- package/dist_save/gridstack.js.map +0 -1
- package/dist_save/gridstack.min.css +0 -1
- package/dist_save/src/gridstack-extra.scss +0 -27
- package/dist_save/src/gridstack.scss +0 -131
- package/dist_save/types.d.ts +0 -284
- package/dist_save/types.js +0 -36
- package/dist_save/types.js.map +0 -1
- package/dist_save/utils.d.ts +0 -95
- package/dist_save/utils.js +0 -548
- package/dist_save/utils.js.map +0 -1
package/dist/gridstack.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:rgba(0,0,0,.1);margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:translate(0,10px) rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:translate(0,10px) rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging,.grid-stack-item.ui-resizable-resizing{z-index:100}.grid-stack-item.ui-draggable-dragging>.grid-stack-item-content,.grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px rgba(0,0,0,.2);opacity:.8}.grid-stack-item.ui-draggable-dragging{will-change:left,top;cursor:move}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}.grid-stack-12>.grid-stack-item{min-width:8.333%}.grid-stack-12>.grid-stack-item[gs-x="1"]{left:8.333%}.grid-stack-12>.grid-stack-item[gs-w="2"]{width:16.667%}.grid-stack-12>.grid-stack-item[gs-x="2"]{left:16.667%}.grid-stack-12>.grid-stack-item[gs-w="3"]{width:25%}.grid-stack-12>.grid-stack-item[gs-x="3"]{left:25%}.grid-stack-12>.grid-stack-item[gs-w="4"]{width:33.333%}.grid-stack-12>.grid-stack-item[gs-x="4"]{left:33.333%}.grid-stack-12>.grid-stack-item[gs-w="5"]{width:41.667%}.grid-stack-12>.grid-stack-item[gs-x="5"]{left:41.667%}.grid-stack-12>.grid-stack-item[gs-w="6"]{width:50%}.grid-stack-12>.grid-stack-item[gs-x="6"]{left:50%}.grid-stack-12>.grid-stack-item[gs-w="7"]{width:58.333%}.grid-stack-12>.grid-stack-item[gs-x="7"]{left:58.333%}.grid-stack-12>.grid-stack-item[gs-w="8"]{width:66.667%}.grid-stack-12>.grid-stack-item[gs-x="8"]{left:66.667%}.grid-stack-12>.grid-stack-item[gs-w="9"]{width:75%}.grid-stack-12>.grid-stack-item[gs-x="9"]{left:75%}.grid-stack-12>.grid-stack-item[gs-w="10"]{width:83.333%}.grid-stack-12>.grid-stack-item[gs-x="10"]{left:83.333%}.grid-stack-12>.grid-stack-item[gs-w="11"]{width:91.667%}.grid-stack-12>.grid-stack-item[gs-x="11"]{left:91.667%}.grid-stack-12>.grid-stack-item[gs-w="12"]{width:100%}.grid-stack-1>.grid-stack-item{min-width:100%}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* gridstack.component.ts 8.0
|
|
2
|
+
* gridstack.component.ts 8.1.0
|
|
3
3
|
* Copyright (c) 2022 Alain Dumesny - see GridStack root license
|
|
4
4
|
*/
|
|
5
5
|
import { AfterContentInit, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList, Type, ViewContainerRef } from '@angular/core';
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
* default to generate [2-11] columns as 1 (oneColumnMode) and 12 (default) are in the main css
|
|
3
3
|
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
@use "sass:math";
|
|
7
|
-
|
|
8
5
|
$gridstack-columns-start: 2 !default;
|
|
9
6
|
$gridstack-columns: 11 !default;
|
|
10
7
|
|
|
11
|
-
@
|
|
12
|
-
|
|
8
|
+
@function fixed($float) {
|
|
9
|
+
@return calc(round($float * 1000) / 1000); // total 4-5 digits being %
|
|
10
|
+
}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
@mixin grid-stack-items($columns) {
|
|
13
|
+
.grid-stack-#{$columns} > .grid-stack-item {
|
|
14
|
+
min-width: fixed(calc(100% / $columns));
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
16
|
+
@for $i from 1 through $columns - 1 {
|
|
17
|
+
&[gs-x='#{$i}'] { left: fixed(calc(100% / $columns) * $i); }
|
|
18
|
+
&[gs-w='#{$i+1}'] { width: fixed(calc(100% / $columns) * ($i+1)); }
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
}
|
package/dist/src/gridstack.scss
CHANGED
|
@@ -1,139 +1,150 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* gridstack SASS styles 8.0
|
|
2
|
+
* gridstack SASS styles 8.1.0
|
|
3
3
|
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
$gridstack-columns: 12 !default;
|
|
6
|
+
$columns: 12 !default;
|
|
9
7
|
$animation_speed: .3s !default;
|
|
10
8
|
|
|
9
|
+
@function fixed($float) {
|
|
10
|
+
@return calc(round($float * 1000) / 1000); // total 4-5 digits being %
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
@mixin vendor($property, $value...){
|
|
12
|
-
-webkit-#{$property}: $value;
|
|
13
|
-
-moz-#{$property}: $value;
|
|
14
|
-
-ms-#{$property}: $value;
|
|
15
|
-
-o-#{$property}: $value;
|
|
14
|
+
// -webkit-#{$property}: $value;
|
|
15
|
+
// -moz-#{$property}: $value;
|
|
16
|
+
// -ms-#{$property}: $value;
|
|
17
|
+
// -o-#{$property}: $value;
|
|
16
18
|
#{$property}: $value;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
:root .grid-stack-item > .ui-resizable-handle { filter: none; }
|
|
20
|
-
|
|
21
21
|
.grid-stack {
|
|
22
22
|
position: relative;
|
|
23
|
+
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
25
|
+
.grid-stack-rtl {
|
|
26
|
+
direction: ltr;
|
|
27
|
+
> .grid-stack-item {
|
|
28
|
+
direction: rtl;
|
|
29
29
|
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.grid-stack-placeholder > .placeholder-content {
|
|
33
|
+
background-color: rgba(0,0,0,0.1);
|
|
34
|
+
margin: 0;
|
|
35
|
+
position: absolute;
|
|
36
|
+
width: auto;
|
|
37
|
+
z-index: 0 !important;
|
|
38
|
+
}
|
|
30
39
|
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
// make those more unique as to not conflict with side panel items
|
|
41
|
+
.grid-stack > .grid-stack-item {
|
|
42
|
+
position: absolute;
|
|
43
|
+
padding: 0;
|
|
44
|
+
|
|
45
|
+
> .grid-stack-item-content {
|
|
33
46
|
margin: 0;
|
|
34
47
|
position: absolute;
|
|
35
48
|
width: auto;
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
overflow-x: hidden;
|
|
50
|
+
overflow-y: auto;
|
|
38
51
|
}
|
|
52
|
+
}
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
.grid-stack-item {
|
|
55
|
+
> .ui-resizable-handle {
|
|
42
56
|
position: absolute;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
width: auto;
|
|
49
|
-
overflow-x: hidden;
|
|
50
|
-
overflow-y: auto;
|
|
51
|
-
}
|
|
57
|
+
font-size: 0.1px;
|
|
58
|
+
display: block;
|
|
59
|
+
-ms-touch-action: none;
|
|
60
|
+
touch-action: none;
|
|
61
|
+
}
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
font-size: 0.1px;
|
|
56
|
-
display: block;
|
|
57
|
-
-ms-touch-action: none;
|
|
58
|
-
touch-action: none;
|
|
59
|
-
}
|
|
63
|
+
&.ui-resizable-disabled > .ui-resizable-handle,
|
|
64
|
+
&.ui-resizable-autohide > .ui-resizable-handle { display: none; }
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
> .ui-resizable-ne,
|
|
67
|
+
> .ui-resizable-nw,
|
|
68
|
+
> .ui-resizable-se,
|
|
69
|
+
> .ui-resizable-sw {
|
|
70
|
+
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
|
71
|
+
background-repeat: no-repeat;
|
|
72
|
+
background-position: center;
|
|
73
|
+
}
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
background-position: center;
|
|
71
|
-
}
|
|
75
|
+
> .ui-resizable-ne {
|
|
76
|
+
@include vendor(transform, translate(0, 10px) rotate(45deg));
|
|
77
|
+
}
|
|
78
|
+
> .ui-resizable-sw {
|
|
79
|
+
@include vendor(transform, rotate(45deg));
|
|
80
|
+
}
|
|
72
81
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
> .ui-resizable-nw {
|
|
83
|
+
@include vendor(transform, translate(0, 10px) rotate(-45deg));
|
|
84
|
+
}
|
|
85
|
+
> .ui-resizable-se {
|
|
86
|
+
@include vendor(transform, rotate(-45deg));
|
|
87
|
+
}
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
> .ui-resizable-nw { cursor: nw-resize; width: 20px; height: 20px; top: 0; }
|
|
90
|
+
> .ui-resizable-n { cursor: n-resize; height: 10px; top: 0; left: 25px; right: 25px; }
|
|
91
|
+
> .ui-resizable-ne { cursor: ne-resize; width: 20px; height: 20px; top: 0; }
|
|
92
|
+
> .ui-resizable-e { cursor: e-resize; width: 10px; top: 15px; bottom: 15px; }
|
|
93
|
+
> .ui-resizable-se { cursor: se-resize; width: 20px; height: 20px;}
|
|
94
|
+
> .ui-resizable-s { cursor: s-resize; height: 10px; left: 25px; bottom: 0; right: 25px; }
|
|
95
|
+
> .ui-resizable-sw { cursor: sw-resize; width: 20px; height: 20px;}
|
|
96
|
+
> .ui-resizable-w { cursor: w-resize; width: 10px; top: 15px; bottom: 15px; }
|
|
97
|
+
|
|
98
|
+
&.ui-draggable-dragging {
|
|
99
|
+
&> .ui-resizable-handle {
|
|
100
|
+
display: none !important;
|
|
85
101
|
}
|
|
102
|
+
}
|
|
86
103
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
> .ui-resizable-e { cursor: e-resize; width: 10px; top: 15px; bottom: 15px; }
|
|
91
|
-
> .ui-resizable-se { cursor: se-resize; width: 20px; height: 20px;}
|
|
92
|
-
> .ui-resizable-s { cursor: s-resize; height: 10px; left: 25px; bottom: 0; right: 25px; }
|
|
93
|
-
> .ui-resizable-sw { cursor: sw-resize; width: 20px; height: 20px;}
|
|
94
|
-
> .ui-resizable-w { cursor: w-resize; width: 10px; top: 15px; bottom: 15px; }
|
|
95
|
-
|
|
96
|
-
&.ui-draggable-dragging {
|
|
97
|
-
&> .ui-resizable-handle {
|
|
98
|
-
display: none !important;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
104
|
+
&.ui-draggable-dragging,
|
|
105
|
+
&.ui-resizable-resizing {
|
|
106
|
+
z-index: 100;
|
|
101
107
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
> .grid-stack-item-content {
|
|
109
|
+
box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.2);
|
|
110
|
+
opacity: 0.8;
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
&.
|
|
109
|
-
|
|
114
|
+
&.ui-draggable-dragging {
|
|
115
|
+
will-change: left, top;
|
|
116
|
+
cursor: move;
|
|
110
117
|
}
|
|
111
118
|
|
|
112
|
-
&.
|
|
113
|
-
|
|
114
|
-
@include vendor(transition, left $animation_speed, top $animation_speed, height $animation_speed, width $animation_speed);
|
|
119
|
+
&.ui-resizable-resizing {
|
|
120
|
+
will-change: width, height;
|
|
115
121
|
}
|
|
122
|
+
}
|
|
116
123
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
@include vendor(transition, left 0s, top 0s, height 0s, width 0s);
|
|
121
|
-
}
|
|
124
|
+
.grid-stack-animate,
|
|
125
|
+
.grid-stack-animate .grid-stack-item {
|
|
126
|
+
@include vendor(transition, left $animation_speed, top $animation_speed, height $animation_speed, width $animation_speed);
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
.ui-draggable-dragging,
|
|
125
|
-
.ui-resizable-resizing
|
|
126
|
-
|
|
129
|
+
.grid-stack-animate .grid-stack-item.ui-draggable-dragging,
|
|
130
|
+
.grid-stack-animate .grid-stack-item.ui-resizable-resizing,
|
|
131
|
+
.grid-stack-animate .grid-stack-item.grid-stack-placeholder{
|
|
132
|
+
@include vendor(transition, left 0s, top 0s, height 0s, width 0s);
|
|
133
|
+
}
|
|
127
134
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
// make those more unique as to not conflict with side panel items
|
|
136
|
+
.grid-stack > .grid-stack-item[gs-x="0"] {
|
|
137
|
+
left: 0%;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.grid-stack-#{$columns} > .grid-stack-item {
|
|
141
|
+
min-width: fixed(calc(100% / $columns));
|
|
142
|
+
@for $i from 1 through ($columns - 1) {
|
|
143
|
+
&[gs-x='#{$i}'] { left: fixed(calc(100% / $columns) * $i); }
|
|
144
|
+
&[gs-w='#{$i + 1}'] { width: fixed(calc(100% / $columns) * ($i + 1)); }
|
|
131
145
|
}
|
|
132
146
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
|
|
148
|
+
.grid-stack-1 > .grid-stack-item {
|
|
149
|
+
min-width: 100%;
|
|
136
150
|
}
|
|
137
|
-
.ui-resizable-resizing {
|
|
138
|
-
will-change: width, height;
|
|
139
|
-
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* types.ts 8.0
|
|
2
|
+
* types.ts 8.1.0
|
|
3
3
|
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
|
|
4
4
|
*/
|
|
5
5
|
import { GridStack } from './gridstack';
|
|
@@ -245,10 +245,12 @@ export interface DDDragOpt {
|
|
|
245
245
|
pause?: boolean | number;
|
|
246
246
|
/** default to `true` */
|
|
247
247
|
scroll?: boolean;
|
|
248
|
+
/** prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' */
|
|
249
|
+
cancel?: string;
|
|
248
250
|
}
|
|
249
251
|
export interface DDDragInOpt extends DDDragOpt {
|
|
250
|
-
/** helper function when dropping
|
|
251
|
-
helper?:
|
|
252
|
+
/** helper function when dropping: 'clone' or your own method */
|
|
253
|
+
helper?: 'clone' | ((event: Event) => HTMLElement);
|
|
252
254
|
}
|
|
253
255
|
export interface Size {
|
|
254
256
|
width: number;
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,yEAAyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C,sBAAsB,EAAE,QAAQ;IAChC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,MAAM;IAClB,kBAAkB,EAAE,GAAG;IACvB,cAAc,EAAE,IAAI;IACpB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;IACjF,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,wBAAwB;IAC1C,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAChD,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,MAAM;IAEX,kCAAkC;IAClC,sBAAsB;IACtB,+BAA+B;IAC/B,wBAAwB;IACxB,gBAAgB;IAChB,qBAAqB;IACrB,+BAA+B;IAC/B,oBAAoB;IACpB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC;AAEF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,MAAM;IAChB,qBAAqB;IACrB,iBAAiB;CAClB,CAAC","sourcesContent":["/**\r\n * types.ts 8.0.1\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStack } from './gridstack';\r\nimport { GridStackEngine } from './gridstack-engine';\r\n\r\n// default values for grid options - used during init and when saving out\r\nexport const gridDefaults: GridStackOptions = {\r\n alwaysShowResizeHandle: 'mobile',\r\n animate: true,\r\n auto: true,\r\n cellHeight: 'auto',\r\n cellHeightThrottle: 100,\r\n cellHeightUnit: 'px',\r\n column: 12,\r\n draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },\r\n handle: '.grid-stack-item-content',\r\n itemClass: 'grid-stack-item',\r\n margin: 10,\r\n marginUnit: 'px',\r\n maxRow: 0,\r\n minRow: 0,\r\n oneColumnSize: 768,\r\n placeholderClass: 'grid-stack-placeholder',\r\n placeholderText: '',\r\n removableOptions: { accept: '.grid-stack-item' },\r\n resizable: { handles: 'se' },\r\n rtl: 'auto',\r\n\r\n // **** same as not being set ****\r\n // disableDrag: false,\r\n // disableOneColumnMode: false,\r\n // disableResize: false,\r\n // float: false,\r\n // handleClass: null,\r\n // oneColumnModeDomSort: false,\r\n // removable: false,\r\n // staticGrid: false,\r\n // styleInHead: false,\r\n};\r\n\r\n/** default dragIn options */\r\nexport const dragInDefaultOptions: DDDragInOpt = {\r\n handle: '.grid-stack-item-content',\r\n appendTo: 'body',\r\n // revert: 'invalid',\r\n // scroll: false,\r\n};\r\n\r\n/** different layout options when changing # of columns,\r\n * including a custom function that takes new/old column count, and array of new/old positions\r\n * Note: new list may be partially already filled if we have a cache of the layout at that size and new items were added later.\r\n */\r\nexport type ColumnOptions = 'moveScale' | 'move' | 'scale' | 'none' |\r\n ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);\r\n\r\nexport type numberOrString = number | string;\r\nexport interface GridItemHTMLElement extends HTMLElement {\r\n /** pointer to grid node instance */\r\n gridstackNode?: GridStackNode;\r\n /** @internal */\r\n _gridstackNodeOrig?: GridStackNode;\r\n}\r\n\r\nexport type GridStackElement = string | HTMLElement | GridItemHTMLElement;\r\n\r\n/** specific and general event handlers for the .on() method */\r\nexport type GridStackEventHandler = (event: Event) => void;\r\nexport type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;\r\nexport type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;\r\nexport type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;\r\nexport type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;\r\n\r\n/** optional function called during load() to callback the user on new added/remove grid items | grids */\r\nexport type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;\r\n\r\n/** optional function called during save() to let the caller add additional custom data to the GridStackWidget structure that will get returned */\r\nexport type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;\r\n\r\n\r\n/**\r\n * Defines the options for a Grid\r\n */\r\nexport interface GridStackOptions {\r\n /**\r\n * accept widgets dragged from other grids or from outside (default: `false`). Can be:\r\n * `true` (uses `'.grid-stack-item'` class filter) or `false`,\r\n * string for explicit class name,\r\n * function returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)\r\n */\r\n acceptWidgets?: boolean | string | ((element: Element) => boolean);\r\n\r\n /** possible values (default: `mobile`) - does not apply to non-resizable widgets\r\n * `false` the resizing handles are only shown while hovering over a widget\r\n * `true` the resizing handles are always shown\r\n * 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`.\r\n See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) */\r\n alwaysShowResizeHandle?: true | false | 'mobile';\r\n\r\n /** turns animation on (default?: true) */\r\n animate?: boolean;\r\n\r\n /** if false gridstack will not initialize existing items (default?: true) */\r\n auto?: boolean;\r\n\r\n /**\r\n * one cell height (default?: 'auto'). Can be:\r\n * an integer (px)\r\n * a string (ex: '100px', '10em', '10rem'). Note: % doesn't right - see demo/cell-height.html\r\n * 0, in which case the library will not generate styles for rows. Everything must be defined in your own CSS files.\r\n * 'auto' - height will be calculated for square cells (width / column) and updated live as you resize the window - also see `cellHeightThrottle`\r\n * 'initial' - similar to 'auto' (start at square cells) but stay that size during window resizing.\r\n */\r\n cellHeight?: numberOrString;\r\n\r\n /** throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100).\r\n * A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!\r\n * */\r\n cellHeightThrottle?: number;\r\n\r\n /** (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') */\r\n cellHeightUnit?: string;\r\n\r\n /** list of children item to create when calling load() or addGrid() */\r\n children?: GridStackWidget[];\r\n\r\n /** number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns.\r\n * Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside\r\n * items always to same. flag is not supported for regular non-nested grids.\r\n */\r\n column?: number | 'auto';\r\n\r\n /** additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance.\r\n Note: only used by addGrid(), else your element should have the needed class */\r\n class?: string;\r\n\r\n /** disallows dragging of widgets (default?: false) */\r\n disableDrag?: boolean;\r\n\r\n /** disables the onColumnMode when the grid width is less than oneColumnSize (default?: false) */\r\n disableOneColumnMode?: boolean;\r\n\r\n /** disallows resizing of widgets (default?: false). */\r\n disableResize?: boolean;\r\n\r\n /** allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) */\r\n draggable?: DDDragOpt;\r\n\r\n /** let user drag nested grid items out of a parent or not (default true - not supported yet) */\r\n //dragOut?: boolean;\r\n\r\n /** the type of engine to create (so you can subclass) default to GridStackEngine */\r\n engineClass?: typeof GridStackEngine;\r\n\r\n /** enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) */\r\n float?: boolean;\r\n\r\n /** draggable handle selector (default?: '.grid-stack-item-content') */\r\n handle?: string;\r\n\r\n /** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */\r\n handleClass?: string;\r\n\r\n /** id used to debug grid instance, not currently stored in DOM attributes */\r\n id?: numberOrString;\r\n\r\n /** additional widget class (default?: 'grid-stack-item') */\r\n itemClass?: string;\r\n\r\n /**\r\n * gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below\r\n * an integer (px)\r\n * a string with possible units (ex: '2em', '20px', '2rem')\r\n * string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS).\r\n * Note: all sides must have same units (last one wins, default px)\r\n */\r\n margin?: numberOrString;\r\n\r\n /** OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. */\r\n marginTop?: numberOrString;\r\n marginRight?: numberOrString;\r\n marginBottom?: numberOrString;\r\n marginLeft?: numberOrString;\r\n\r\n /** (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') */\r\n marginUnit?: string;\r\n\r\n /** maximum rows amount. Default? is 0 which means no maximum rows */\r\n maxRow?: number;\r\n\r\n /** minimum rows amount. Default is `0`. You can also do this with `min-height` CSS attribute\r\n * on the grid div in pixels, which will round to the closest row.\r\n */\r\n minRow?: number;\r\n\r\n /** If you are using a nonce-based Content Security Policy, pass your nonce here and\r\n * GridStack will add it to the <style> elements it creates. */\r\n nonce?: string;\r\n\r\n /** minimal width before grid will be shown in one column mode (default?: 768) */\r\n oneColumnSize?: number;\r\n\r\n /**\r\n * set to true if you want oneColumnMode to use the DOM order and ignore x,y from normal multi column\r\n * layouts during sorting. This enables you to have custom 1 column layout that differ from the rest. (default?: false)\r\n */\r\n oneColumnModeDomSort?: boolean;\r\n\r\n /** class for placeholder (default?: 'grid-stack-placeholder') */\r\n placeholderClass?: string;\r\n\r\n /** placeholder default content (default?: '') */\r\n placeholderText?: string;\r\n\r\n /** allows to override UI resizable options. (default?: { handles: 'se' }) */\r\n resizable?: DDResizeOpt;\r\n\r\n /**\r\n * if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: \".trash\"),\r\n * in this case widgets will be removed by dropping them there (default?: false)\r\n * See example (http://gridstack.github.io/gridstack.js/demo/two.html)\r\n */\r\n removable?: boolean | string;\r\n\r\n /** allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) */\r\n removableOptions?: DDRemoveOpt;\r\n\r\n /** fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) */\r\n row?: number;\r\n\r\n /**\r\n * if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')\r\n * See [example](http://gridstack.github.io/gridstack.js/demo/rtl.html)\r\n */\r\n rtl?: boolean | 'auto';\r\n\r\n /**\r\n * makes grid static (default?: false). If `true` widgets are not movable/resizable.\r\n * You don't even need draggable/resizable. A CSS class\r\n * 'grid-stack-static' is also added to the element.\r\n */\r\n staticGrid?: boolean;\r\n\r\n /** if `true` will add style element to `<head>` otherwise will add it to element's parent node (default `false`). */\r\n styleInHead?: boolean;\r\n\r\n /** list of differences in options for automatically created sub-grids under us (inside our grid-items) */\r\n subGridOpts?: GridStackOptions;\r\n\r\n /** enable/disable the creation of sub-grids on the fly by dragging items completely\r\n * over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. */\r\n subGridDynamic?: boolean;\r\n}\r\n\r\n/** options used during GridStackEngine.moveNode() */\r\nexport interface GridStackMoveOpts extends GridStackPosition {\r\n /** node to skip collision */\r\n skip?: GridStackNode;\r\n /** do we pack (default true) */\r\n pack?: boolean;\r\n /** true if we are calling this recursively to prevent simple swap or coverage collision - default false*/\r\n nested?: boolean;\r\n /** vars to calculate other cells coordinates */\r\n cellWidth?: number;\r\n cellHeight?: number;\r\n marginTop?: number;\r\n marginBottom?: number;\r\n marginLeft?: number;\r\n marginRight?: number;\r\n /** position in pixels of the currently dragged items (for overlap check) */\r\n rect?: GridStackPosition;\r\n /** true if we're live resizing */\r\n resizing?: boolean;\r\n /** best node (most coverage) we collied with */\r\n collide?: GridStackNode;\r\n}\r\n\r\nexport interface GridStackPosition {\r\n /** widget position x (default?: 0) */\r\n x?: number;\r\n /** widget position y (default?: 0) */\r\n y?: number;\r\n /** widget dimension width (default?: 1) */\r\n w?: number;\r\n /** widget dimension height (default?: 1) */\r\n h?: number;\r\n}\r\n\r\n/**\r\n * GridStack Widget creation options\r\n */\r\nexport interface GridStackWidget extends GridStackPosition {\r\n /** if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) */\r\n autoPosition?: boolean;\r\n /** minimum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n minW?: number;\r\n /** maximum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxW?: number;\r\n /** minimum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n minH?: number;\r\n /** maximum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxH?: number;\r\n /** prevent resizing (default?: undefined = un-constrained) */\r\n noResize?: boolean;\r\n /** prevents moving (default?: undefined = un-constrained) */\r\n noMove?: boolean;\r\n /** prevents being moved by others during their (default?: undefined = un-constrained) */\r\n locked?: boolean;\r\n /** value for `gs-id` stored on the widget (default?: undefined) */\r\n id?: numberOrString;\r\n /** html to append inside as content */\r\n content?: string;\r\n /** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */\r\n subGridOpts?: GridStackOptions;\r\n}\r\n\r\n/** Drag&Drop resize options */\r\nexport interface DDResizeOpt {\r\n /** do resize handle hide by default until mouse over ? - default: true on desktop, false on mobile*/\r\n autoHide?: boolean;\r\n /**\r\n * sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east)\r\n * Note: it is not recommended to resize from the top sides as weird side effect may occur.\r\n */\r\n handles?: string;\r\n}\r\n\r\n/** Drag&Drop remove options */\r\nexport interface DDRemoveOpt {\r\n /** class that can be removed (default?: '.' + opts.itemClass) */\r\n accept?: string;\r\n}\r\n\r\n/** Drag&Drop dragging options */\r\nexport interface DDDragOpt {\r\n /** class selector of items that can be dragged. default to '.grid-stack-item-content' */\r\n handle?: string;\r\n /** default to 'body' */\r\n appendTo?: string;\r\n /** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */\r\n pause?: boolean | number;\r\n /** default to `true` */\r\n scroll?: boolean;\r\n /** parent constraining where item can be dragged out from (default: null = no constrain) */\r\n // containment?: string;\r\n}\r\nexport interface DDDragInOpt extends DDDragOpt {\r\n /** helper function when dropping (ex: 'clone' or your own method) */\r\n helper?: string | ((event: Event) => HTMLElement);\r\n /** used when dragging item from the outside, and canceling (ex: 'invalid' or your own method)*/\r\n // revert?: string | ((event: Event) => HTMLElement);\r\n}\r\n\r\nexport interface Size {\r\n width: number;\r\n height: number;\r\n}\r\nexport interface Position {\r\n top: number;\r\n left: number;\r\n}\r\nexport interface Rect extends Size, Position {}\r\n\r\n/** data that is passed during drag and resizing callbacks */\r\nexport interface DDUIData {\r\n position?: Position;\r\n size?: Size;\r\n draggable?: HTMLElement;\r\n /* fields not used by GridStack but sent by jq ? leave in case we go back to them...\r\n originalPosition? : Position;\r\n offset?: Position;\r\n originalSize?: Size;\r\n element?: HTMLElement[];\r\n helper?: HTMLElement[];\r\n originalElement?: HTMLElement[];\r\n */\r\n}\r\n\r\n/**\r\n * internal descriptions describing the items in the grid\r\n */\r\nexport interface GridStackNode extends GridStackWidget {\r\n /** pointer back to HTML element */\r\n el?: GridItemHTMLElement;\r\n /** pointer back to parent Grid instance */\r\n grid?: GridStack;\r\n /** actual sub-grid instance */\r\n subGrid?: GridStack;\r\n /** @internal internal id used to match when cloning engines or saving column layouts */\r\n _id?: number;\r\n /** @internal */\r\n _dirty?: boolean;\r\n /** @internal */\r\n _updating?: boolean;\r\n /** @internal true when over trash/another grid so we don't bother removing drag CSS style that would animate back to old position */\r\n _isAboutToRemove?: boolean;\r\n /** @internal true if item came from outside of the grid -> actual item need to be moved over */\r\n _isExternal?: boolean;\r\n /** @internal Mouse event that's causing moving|resizing */\r\n _event?: MouseEvent;\r\n /** @internal moving vs resizing */\r\n _moving?: boolean;\r\n /** @internal true if we jumped down past item below (one time jump so we don't have to totally pass it) */\r\n _skipDown?: boolean;\r\n /** @internal original values before a drag/size */\r\n _orig?: GridStackPosition;\r\n /** @internal position in pixels used during collision check */\r\n _rect?: GridStackPosition;\r\n /** @internal top/left pixel location before a drag so we can detect direction of move from last position*/\r\n _lastUiPosition?: Position;\r\n /** @internal set on the item being dragged/resized remember the last positions we've tried (but failed) so we don't try again during drag/resize */\r\n _lastTried?: GridStackPosition;\r\n /** @internal position willItFit() will use to position the item */\r\n _willFitPos?: GridStackPosition;\r\n /** @internal last drag Y pixel position used to incrementally update V scroll bar */\r\n _prevYPix?: number;\r\n /** @internal true if we've remove the item from ourself (dragging out) but might revert it back (release on nothing -> goes back) */\r\n _temporaryRemoved?: boolean;\r\n /** @internal true if we should remove DOM element on _notify() rather than clearing _id (old way) */\r\n _removeDOM?: boolean;\r\n /** @internal */\r\n _initDD?: boolean;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,yEAAyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C,sBAAsB,EAAE,QAAQ;IAChC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,MAAM;IAClB,kBAAkB,EAAE,GAAG;IACvB,cAAc,EAAE,IAAI;IACpB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;IACjF,MAAM,EAAE,0BAA0B;IAClC,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,aAAa,EAAE,GAAG;IAClB,gBAAgB,EAAE,wBAAwB;IAC1C,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAChD,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,MAAM;IAEX,kCAAkC;IAClC,sBAAsB;IACtB,+BAA+B;IAC/B,wBAAwB;IACxB,gBAAgB;IAChB,qBAAqB;IACrB,+BAA+B;IAC/B,oBAAoB;IACpB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC;AAEF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,MAAM;IAChB,qBAAqB;IACrB,iBAAiB;CAClB,CAAC","sourcesContent":["/**\r\n * types.ts 8.1.0\r\n * Copyright (c) 2021 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStack } from './gridstack';\r\nimport { GridStackEngine } from './gridstack-engine';\r\n\r\n// default values for grid options - used during init and when saving out\r\nexport const gridDefaults: GridStackOptions = {\r\n alwaysShowResizeHandle: 'mobile',\r\n animate: true,\r\n auto: true,\r\n cellHeight: 'auto',\r\n cellHeightThrottle: 100,\r\n cellHeightUnit: 'px',\r\n column: 12,\r\n draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },\r\n handle: '.grid-stack-item-content',\r\n itemClass: 'grid-stack-item',\r\n margin: 10,\r\n marginUnit: 'px',\r\n maxRow: 0,\r\n minRow: 0,\r\n oneColumnSize: 768,\r\n placeholderClass: 'grid-stack-placeholder',\r\n placeholderText: '',\r\n removableOptions: { accept: '.grid-stack-item' },\r\n resizable: { handles: 'se' },\r\n rtl: 'auto',\r\n\r\n // **** same as not being set ****\r\n // disableDrag: false,\r\n // disableOneColumnMode: false,\r\n // disableResize: false,\r\n // float: false,\r\n // handleClass: null,\r\n // oneColumnModeDomSort: false,\r\n // removable: false,\r\n // staticGrid: false,\r\n // styleInHead: false,\r\n};\r\n\r\n/** default dragIn options */\r\nexport const dragInDefaultOptions: DDDragInOpt = {\r\n handle: '.grid-stack-item-content',\r\n appendTo: 'body',\r\n // revert: 'invalid',\r\n // scroll: false,\r\n};\r\n\r\n/** different layout options when changing # of columns,\r\n * including a custom function that takes new/old column count, and array of new/old positions\r\n * Note: new list may be partially already filled if we have a cache of the layout at that size and new items were added later.\r\n */\r\nexport type ColumnOptions = 'moveScale' | 'move' | 'scale' | 'none' |\r\n ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);\r\n\r\nexport type numberOrString = number | string;\r\nexport interface GridItemHTMLElement extends HTMLElement {\r\n /** pointer to grid node instance */\r\n gridstackNode?: GridStackNode;\r\n /** @internal */\r\n _gridstackNodeOrig?: GridStackNode;\r\n}\r\n\r\nexport type GridStackElement = string | HTMLElement | GridItemHTMLElement;\r\n\r\n/** specific and general event handlers for the .on() method */\r\nexport type GridStackEventHandler = (event: Event) => void;\r\nexport type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;\r\nexport type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;\r\nexport type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;\r\nexport type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;\r\n\r\n/** optional function called during load() to callback the user on new added/remove grid items | grids */\r\nexport type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;\r\n\r\n/** optional function called during save() to let the caller add additional custom data to the GridStackWidget structure that will get returned */\r\nexport type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;\r\n\r\n\r\n/**\r\n * Defines the options for a Grid\r\n */\r\nexport interface GridStackOptions {\r\n /**\r\n * accept widgets dragged from other grids or from outside (default: `false`). Can be:\r\n * `true` (uses `'.grid-stack-item'` class filter) or `false`,\r\n * string for explicit class name,\r\n * function returning a boolean. See [example](http://gridstack.github.io/gridstack.js/demo/two.html)\r\n */\r\n acceptWidgets?: boolean | string | ((element: Element) => boolean);\r\n\r\n /** possible values (default: `mobile`) - does not apply to non-resizable widgets\r\n * `false` the resizing handles are only shown while hovering over a widget\r\n * `true` the resizing handles are always shown\r\n * 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`.\r\n See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) */\r\n alwaysShowResizeHandle?: true | false | 'mobile';\r\n\r\n /** turns animation on (default?: true) */\r\n animate?: boolean;\r\n\r\n /** if false gridstack will not initialize existing items (default?: true) */\r\n auto?: boolean;\r\n\r\n /**\r\n * one cell height (default?: 'auto'). Can be:\r\n * an integer (px)\r\n * a string (ex: '100px', '10em', '10rem'). Note: % doesn't right - see demo/cell-height.html\r\n * 0, in which case the library will not generate styles for rows. Everything must be defined in your own CSS files.\r\n * 'auto' - height will be calculated for square cells (width / column) and updated live as you resize the window - also see `cellHeightThrottle`\r\n * 'initial' - similar to 'auto' (start at square cells) but stay that size during window resizing.\r\n */\r\n cellHeight?: numberOrString;\r\n\r\n /** throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100).\r\n * A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!\r\n * */\r\n cellHeightThrottle?: number;\r\n\r\n /** (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') */\r\n cellHeightUnit?: string;\r\n\r\n /** list of children item to create when calling load() or addGrid() */\r\n children?: GridStackWidget[];\r\n\r\n /** number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns.\r\n * Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside\r\n * items always to same. flag is not supported for regular non-nested grids.\r\n */\r\n column?: number | 'auto';\r\n\r\n /** additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance.\r\n Note: only used by addGrid(), else your element should have the needed class */\r\n class?: string;\r\n\r\n /** disallows dragging of widgets (default?: false) */\r\n disableDrag?: boolean;\r\n\r\n /** disables the onColumnMode when the grid width is less than oneColumnSize (default?: false) */\r\n disableOneColumnMode?: boolean;\r\n\r\n /** disallows resizing of widgets (default?: false). */\r\n disableResize?: boolean;\r\n\r\n /** allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) */\r\n draggable?: DDDragOpt;\r\n\r\n /** let user drag nested grid items out of a parent or not (default true - not supported yet) */\r\n //dragOut?: boolean;\r\n\r\n /** the type of engine to create (so you can subclass) default to GridStackEngine */\r\n engineClass?: typeof GridStackEngine;\r\n\r\n /** enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) */\r\n float?: boolean;\r\n\r\n /** draggable handle selector (default?: '.grid-stack-item-content') */\r\n handle?: string;\r\n\r\n /** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */\r\n handleClass?: string;\r\n\r\n /** id used to debug grid instance, not currently stored in DOM attributes */\r\n id?: numberOrString;\r\n\r\n /** additional widget class (default?: 'grid-stack-item') */\r\n itemClass?: string;\r\n\r\n /**\r\n * gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below\r\n * an integer (px)\r\n * a string with possible units (ex: '2em', '20px', '2rem')\r\n * string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS).\r\n * Note: all sides must have same units (last one wins, default px)\r\n */\r\n margin?: numberOrString;\r\n\r\n /** OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. */\r\n marginTop?: numberOrString;\r\n marginRight?: numberOrString;\r\n marginBottom?: numberOrString;\r\n marginLeft?: numberOrString;\r\n\r\n /** (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') */\r\n marginUnit?: string;\r\n\r\n /** maximum rows amount. Default? is 0 which means no maximum rows */\r\n maxRow?: number;\r\n\r\n /** minimum rows amount. Default is `0`. You can also do this with `min-height` CSS attribute\r\n * on the grid div in pixels, which will round to the closest row.\r\n */\r\n minRow?: number;\r\n\r\n /** If you are using a nonce-based Content Security Policy, pass your nonce here and\r\n * GridStack will add it to the <style> elements it creates. */\r\n nonce?: string;\r\n\r\n /** minimal width before grid will be shown in one column mode (default?: 768) */\r\n oneColumnSize?: number;\r\n\r\n /**\r\n * set to true if you want oneColumnMode to use the DOM order and ignore x,y from normal multi column\r\n * layouts during sorting. This enables you to have custom 1 column layout that differ from the rest. (default?: false)\r\n */\r\n oneColumnModeDomSort?: boolean;\r\n\r\n /** class for placeholder (default?: 'grid-stack-placeholder') */\r\n placeholderClass?: string;\r\n\r\n /** placeholder default content (default?: '') */\r\n placeholderText?: string;\r\n\r\n /** allows to override UI resizable options. (default?: { handles: 'se' }) */\r\n resizable?: DDResizeOpt;\r\n\r\n /**\r\n * if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: \".trash\"),\r\n * in this case widgets will be removed by dropping them there (default?: false)\r\n * See example (http://gridstack.github.io/gridstack.js/demo/two.html)\r\n */\r\n removable?: boolean | string;\r\n\r\n /** allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) */\r\n removableOptions?: DDRemoveOpt;\r\n\r\n /** fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) */\r\n row?: number;\r\n\r\n /**\r\n * if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')\r\n * See [example](http://gridstack.github.io/gridstack.js/demo/rtl.html)\r\n */\r\n rtl?: boolean | 'auto';\r\n\r\n /**\r\n * makes grid static (default?: false). If `true` widgets are not movable/resizable.\r\n * You don't even need draggable/resizable. A CSS class\r\n * 'grid-stack-static' is also added to the element.\r\n */\r\n staticGrid?: boolean;\r\n\r\n /** if `true` will add style element to `<head>` otherwise will add it to element's parent node (default `false`). */\r\n styleInHead?: boolean;\r\n\r\n /** list of differences in options for automatically created sub-grids under us (inside our grid-items) */\r\n subGridOpts?: GridStackOptions;\r\n\r\n /** enable/disable the creation of sub-grids on the fly by dragging items completely\r\n * over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. */\r\n subGridDynamic?: boolean;\r\n}\r\n\r\n/** options used during GridStackEngine.moveNode() */\r\nexport interface GridStackMoveOpts extends GridStackPosition {\r\n /** node to skip collision */\r\n skip?: GridStackNode;\r\n /** do we pack (default true) */\r\n pack?: boolean;\r\n /** true if we are calling this recursively to prevent simple swap or coverage collision - default false*/\r\n nested?: boolean;\r\n /** vars to calculate other cells coordinates */\r\n cellWidth?: number;\r\n cellHeight?: number;\r\n marginTop?: number;\r\n marginBottom?: number;\r\n marginLeft?: number;\r\n marginRight?: number;\r\n /** position in pixels of the currently dragged items (for overlap check) */\r\n rect?: GridStackPosition;\r\n /** true if we're live resizing */\r\n resizing?: boolean;\r\n /** best node (most coverage) we collied with */\r\n collide?: GridStackNode;\r\n}\r\n\r\nexport interface GridStackPosition {\r\n /** widget position x (default?: 0) */\r\n x?: number;\r\n /** widget position y (default?: 0) */\r\n y?: number;\r\n /** widget dimension width (default?: 1) */\r\n w?: number;\r\n /** widget dimension height (default?: 1) */\r\n h?: number;\r\n}\r\n\r\n/**\r\n * GridStack Widget creation options\r\n */\r\nexport interface GridStackWidget extends GridStackPosition {\r\n /** if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) */\r\n autoPosition?: boolean;\r\n /** minimum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n minW?: number;\r\n /** maximum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxW?: number;\r\n /** minimum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n minH?: number;\r\n /** maximum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n maxH?: number;\r\n /** prevent resizing (default?: undefined = un-constrained) */\r\n noResize?: boolean;\r\n /** prevents moving (default?: undefined = un-constrained) */\r\n noMove?: boolean;\r\n /** prevents being moved by others during their (default?: undefined = un-constrained) */\r\n locked?: boolean;\r\n /** value for `gs-id` stored on the widget (default?: undefined) */\r\n id?: numberOrString;\r\n /** html to append inside as content */\r\n content?: string;\r\n /** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */\r\n subGridOpts?: GridStackOptions;\r\n}\r\n\r\n/** Drag&Drop resize options */\r\nexport interface DDResizeOpt {\r\n /** do resize handle hide by default until mouse over ? - default: true on desktop, false on mobile*/\r\n autoHide?: boolean;\r\n /**\r\n * sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east)\r\n * Note: it is not recommended to resize from the top sides as weird side effect may occur.\r\n */\r\n handles?: string;\r\n}\r\n\r\n/** Drag&Drop remove options */\r\nexport interface DDRemoveOpt {\r\n /** class that can be removed (default?: '.' + opts.itemClass) */\r\n accept?: string;\r\n}\r\n\r\n/** Drag&Drop dragging options */\r\nexport interface DDDragOpt {\r\n /** class selector of items that can be dragged. default to '.grid-stack-item-content' */\r\n handle?: string;\r\n /** default to 'body' */\r\n appendTo?: string;\r\n /** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */\r\n pause?: boolean | number;\r\n /** default to `true` */\r\n scroll?: boolean;\r\n /** prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' */\r\n cancel?: string;\r\n}\r\nexport interface DDDragInOpt extends DDDragOpt {\r\n /** helper function when dropping: 'clone' or your own method */\r\n helper?: 'clone' | ((event: Event) => HTMLElement);\r\n /** used when dragging item from the outside, and canceling (ex: 'invalid' or your own method)*/\r\n // revert?: string | ((event: Event) => HTMLElement);\r\n}\r\n\r\nexport interface Size {\r\n width: number;\r\n height: number;\r\n}\r\nexport interface Position {\r\n top: number;\r\n left: number;\r\n}\r\nexport interface Rect extends Size, Position {}\r\n\r\n/** data that is passed during drag and resizing callbacks */\r\nexport interface DDUIData {\r\n position?: Position;\r\n size?: Size;\r\n draggable?: HTMLElement;\r\n /* fields not used by GridStack but sent by jq ? leave in case we go back to them...\r\n originalPosition? : Position;\r\n offset?: Position;\r\n originalSize?: Size;\r\n element?: HTMLElement[];\r\n helper?: HTMLElement[];\r\n originalElement?: HTMLElement[];\r\n */\r\n}\r\n\r\n/**\r\n * internal descriptions describing the items in the grid\r\n */\r\nexport interface GridStackNode extends GridStackWidget {\r\n /** pointer back to HTML element */\r\n el?: GridItemHTMLElement;\r\n /** pointer back to parent Grid instance */\r\n grid?: GridStack;\r\n /** actual sub-grid instance */\r\n subGrid?: GridStack;\r\n /** @internal internal id used to match when cloning engines or saving column layouts */\r\n _id?: number;\r\n /** @internal */\r\n _dirty?: boolean;\r\n /** @internal */\r\n _updating?: boolean;\r\n /** @internal true when over trash/another grid so we don't bother removing drag CSS style that would animate back to old position */\r\n _isAboutToRemove?: boolean;\r\n /** @internal true if item came from outside of the grid -> actual item need to be moved over */\r\n _isExternal?: boolean;\r\n /** @internal Mouse event that's causing moving|resizing */\r\n _event?: MouseEvent;\r\n /** @internal moving vs resizing */\r\n _moving?: boolean;\r\n /** @internal true if we jumped down past item below (one time jump so we don't have to totally pass it) */\r\n _skipDown?: boolean;\r\n /** @internal original values before a drag/size */\r\n _orig?: GridStackPosition;\r\n /** @internal position in pixels used during collision check */\r\n _rect?: GridStackPosition;\r\n /** @internal top/left pixel location before a drag so we can detect direction of move from last position*/\r\n _lastUiPosition?: Position;\r\n /** @internal set on the item being dragged/resized remember the last positions we've tried (but failed) so we don't try again during drag/resize */\r\n _lastTried?: GridStackPosition;\r\n /** @internal position willItFit() will use to position the item */\r\n _willFitPos?: GridStackPosition;\r\n /** @internal last drag Y pixel position used to incrementally update V scroll bar */\r\n _prevYPix?: number;\r\n /** @internal true if we've remove the item from ourself (dragging out) but might revert it back (release on nothing -> goes back) */\r\n _temporaryRemoved?: boolean;\r\n /** @internal true if we should remove DOM element on _notify() rather than clearing _id (old way) */\r\n _removeDOM?: boolean;\r\n /** @internal */\r\n _initDD?: boolean;\r\n}\r\n"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* utils.ts 8.0
|
|
2
|
+
* utils.ts 8.1.0
|
|
3
3
|
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
|
|
4
4
|
*/
|
|
5
5
|
import { GridStackElement, GridStackNode, GridStackOptions, numberOrString, GridStackPosition, GridStackWidget } from './types';
|
|
@@ -20,9 +20,9 @@ export declare function obsoleteAttr(el: HTMLElement, oldName: string, newName:
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class Utils {
|
|
22
22
|
/** convert a potential selector into actual list of html elements. optional root which defaults to document (for shadow dom) */
|
|
23
|
-
static getElements(els: GridStackElement, root?: Document): HTMLElement[];
|
|
23
|
+
static getElements(els: GridStackElement, root?: HTMLElement | Document): HTMLElement[];
|
|
24
24
|
/** convert a potential selector into actual single element. optional root which defaults to document (for shadow dom) */
|
|
25
|
-
static getElement(els: GridStackElement, root?: Document): HTMLElement;
|
|
25
|
+
static getElement(els: GridStackElement, root?: HTMLElement | Document): HTMLElement;
|
|
26
26
|
/** returns true if a and b overlap */
|
|
27
27
|
static isIntercepted(a: GridStackPosition, b: GridStackPosition): boolean;
|
|
28
28
|
/** returns true if a and b touch edges or corners */
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* utils.ts 8.0
|
|
2
|
+
* utils.ts 8.1.0
|
|
3
3
|
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
|
|
4
4
|
*/
|
|
5
5
|
/** checks for obsolete method names */
|
|
@@ -42,12 +42,13 @@ export function obsoleteAttr(el, oldName, newName, rev) {
|
|
|
42
42
|
export class Utils {
|
|
43
43
|
/** convert a potential selector into actual list of html elements. optional root which defaults to document (for shadow dom) */
|
|
44
44
|
static getElements(els, root = document) {
|
|
45
|
+
const doc = ('getElementById' in root) ? root : undefined;
|
|
45
46
|
if (typeof els === 'string') {
|
|
46
47
|
// Note: very common for people use to id='1,2,3' which is only legal as HTML5 id, but not CSS selectors
|
|
47
48
|
// so if we start with a number, assume it's an id and just return that one item...
|
|
48
49
|
// see https://github.com/gridstack/gridstack.js/issues/2234#issuecomment-1523796562
|
|
49
|
-
if (!isNaN(+els[0])) { // start with digit
|
|
50
|
-
const el =
|
|
50
|
+
if (doc && !isNaN(+els[0])) { // start with digit
|
|
51
|
+
const el = doc.getElementById(els);
|
|
51
52
|
return el ? [el] : [];
|
|
52
53
|
}
|
|
53
54
|
let list = root.querySelectorAll(els);
|
|
@@ -63,23 +64,24 @@ export class Utils {
|
|
|
63
64
|
}
|
|
64
65
|
/** convert a potential selector into actual single element. optional root which defaults to document (for shadow dom) */
|
|
65
66
|
static getElement(els, root = document) {
|
|
67
|
+
const doc = ('getElementById' in root) ? root : undefined;
|
|
66
68
|
if (typeof els === 'string') {
|
|
67
69
|
if (!els.length)
|
|
68
70
|
return null;
|
|
69
|
-
if (els[0] === '#') {
|
|
70
|
-
return
|
|
71
|
+
if (doc && els[0] === '#') {
|
|
72
|
+
return doc.getElementById(els.substring(1));
|
|
71
73
|
}
|
|
72
|
-
if (els[0] === '.' || els[0] === '[') {
|
|
74
|
+
if (els[0] === '#' || els[0] === '.' || els[0] === '[') {
|
|
73
75
|
return root.querySelector(els);
|
|
74
76
|
}
|
|
75
77
|
// if we start with a digit, assume it's an id (error calling querySelector('#1')) as class are not valid CSS
|
|
76
|
-
if (!isNaN(+els[0])) { // start with digit
|
|
77
|
-
return
|
|
78
|
+
if (doc && !isNaN(+els[0])) { // start with digit
|
|
79
|
+
return doc.getElementById(els);
|
|
78
80
|
}
|
|
79
81
|
// finally try string, then id, then class
|
|
80
82
|
let el = root.querySelector(els);
|
|
81
|
-
if (!el) {
|
|
82
|
-
el =
|
|
83
|
+
if (doc && !el) {
|
|
84
|
+
el = doc.getElementById(els);
|
|
83
85
|
}
|
|
84
86
|
if (!el) {
|
|
85
87
|
el = root.querySelector('.' + els);
|