gridstack 4.2.6 → 4.4.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 +29 -19
- package/dist/es5/gridstack-dd.d.ts +35 -0
- package/dist/es5/gridstack-dd.js +683 -0
- package/dist/es5/gridstack-dd.js.map +1 -0
- package/dist/es5/gridstack-ddi.d.ts +17 -0
- package/dist/es5/gridstack-ddi.js +31 -0
- package/dist/es5/gridstack-ddi.js.map +1 -0
- package/dist/es5/gridstack-engine.d.ts +93 -0
- package/dist/es5/gridstack-engine.js +955 -0
- package/dist/es5/gridstack-engine.js.map +1 -0
- package/dist/es5/gridstack-h5.d.ts +10 -0
- package/dist/es5/gridstack-h5.js +3 -0
- package/dist/es5/gridstack-h5.js.LICENSE.txt +7 -0
- package/dist/es5/gridstack-h5.js.map +1 -0
- package/dist/es5/gridstack-jq.d.ts +10 -0
- package/dist/es5/gridstack-jq.js +3 -0
- package/dist/es5/gridstack-jq.js.LICENSE.txt +99 -0
- package/dist/es5/gridstack-jq.js.map +1 -0
- package/dist/{gridstack-poly.js → es5/gridstack-poly.js} +152 -1
- package/dist/es5/gridstack-static.d.ts +9 -0
- package/dist/es5/gridstack-static.js +3 -0
- package/dist/es5/gridstack-static.js.LICENSE.txt +7 -0
- package/dist/es5/gridstack-static.js.map +1 -0
- package/dist/es5/gridstack.d.ts +346 -0
- package/dist/es5/gridstack.js +1482 -0
- package/dist/es5/gridstack.js.map +1 -0
- package/dist/es5/h5/dd-base-impl.d.ts +20 -0
- package/dist/es5/h5/dd-base-impl.js +43 -0
- package/dist/es5/h5/dd-base-impl.js.map +1 -0
- package/dist/es5/h5/dd-draggable.d.ts +30 -0
- package/dist/es5/h5/dd-draggable.js +319 -0
- package/dist/es5/h5/dd-draggable.js.map +1 -0
- package/dist/es5/h5/dd-droppable.d.ts +23 -0
- package/dist/es5/h5/dd-droppable.js +182 -0
- package/dist/es5/h5/dd-droppable.js.map +1 -0
- package/dist/es5/h5/dd-element.d.ts +27 -0
- package/dist/es5/h5/dd-element.js +96 -0
- package/dist/es5/h5/dd-element.js.map +1 -0
- package/dist/es5/h5/dd-manager.d.ts +8 -0
- package/dist/es5/h5/dd-manager.js +14 -0
- package/dist/es5/h5/dd-manager.js.map +1 -0
- package/dist/es5/h5/dd-resizable-handle.d.ts +14 -0
- package/dist/es5/h5/dd-resizable-handle.js +83 -0
- package/dist/es5/h5/dd-resizable-handle.js.map +1 -0
- package/dist/es5/h5/dd-resizable.d.ts +29 -0
- package/dist/es5/h5/dd-resizable.js +302 -0
- package/dist/es5/h5/dd-resizable.js.map +1 -0
- package/dist/es5/h5/dd-utils.d.ts +17 -0
- package/dist/es5/h5/dd-utils.js +99 -0
- package/dist/es5/h5/dd-utils.js.map +1 -0
- package/dist/es5/h5/gridstack-dd-native.d.ts +26 -0
- package/dist/es5/h5/gridstack-dd-native.js +175 -0
- package/dist/es5/h5/gridstack-dd-native.js.map +1 -0
- package/dist/es5/jq/gridstack-dd-jqueryui.d.ts +22 -0
- package/dist/es5/jq/gridstack-dd-jqueryui.js +162 -0
- package/dist/es5/jq/gridstack-dd-jqueryui.js.map +1 -0
- package/dist/es5/types.d.ts +258 -0
- package/dist/es5/types.js +7 -0
- package/dist/es5/types.js.map +1 -0
- package/dist/es5/utils.d.ts +73 -0
- package/dist/es5/utils.js +444 -0
- package/dist/es5/utils.js.map +1 -0
- package/dist/gridstack-dd.d.ts +1 -1
- package/dist/gridstack-dd.js +16 -8
- package/dist/gridstack-dd.js.map +1 -1
- package/dist/gridstack-ddi.d.ts +1 -1
- package/dist/gridstack-ddi.js +1 -1
- package/dist/gridstack-ddi.js.map +1 -1
- package/dist/gridstack-engine.d.ts +3 -2
- package/dist/gridstack-engine.js +101 -61
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack-extra.css +800 -530
- package/dist/gridstack-extra.min.css +1 -1
- package/dist/gridstack-h5.d.ts +1 -1
- package/dist/gridstack-h5.js +1 -1
- package/dist/gridstack-h5.js.LICENSE.txt +1 -1
- package/dist/gridstack-h5.js.map +1 -1
- package/dist/gridstack-jq.d.ts +1 -1
- package/dist/gridstack-jq.js +1 -1
- package/dist/gridstack-jq.js.LICENSE.txt +1 -1
- package/dist/gridstack-jq.js.map +1 -1
- package/dist/gridstack-static.d.ts +1 -1
- package/dist/gridstack-static.js +1 -1
- package/dist/gridstack-static.js.LICENSE.txt +1 -1
- package/dist/gridstack-static.js.map +1 -1
- package/dist/gridstack.css +305 -228
- package/dist/gridstack.d.ts +1 -1
- package/dist/gridstack.js +19 -12
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/h5/dd-base-impl.d.ts +1 -1
- package/dist/h5/dd-base-impl.js +1 -1
- package/dist/h5/dd-base-impl.js.map +1 -1
- package/dist/h5/dd-draggable.d.ts +1 -1
- package/dist/h5/dd-draggable.js +1 -1
- package/dist/h5/dd-draggable.js.map +1 -1
- package/dist/h5/dd-droppable.d.ts +1 -1
- package/dist/h5/dd-droppable.js +1 -1
- package/dist/h5/dd-droppable.js.map +1 -1
- package/dist/h5/dd-element.d.ts +1 -1
- package/dist/h5/dd-element.js +1 -1
- package/dist/h5/dd-element.js.map +1 -1
- package/dist/h5/dd-manager.d.ts +1 -1
- package/dist/h5/dd-manager.js +1 -1
- package/dist/h5/dd-manager.js.map +1 -1
- package/dist/h5/dd-resizable-handle.d.ts +1 -1
- package/dist/h5/dd-resizable-handle.js +1 -1
- package/dist/h5/dd-resizable-handle.js.map +1 -1
- package/dist/h5/dd-resizable.d.ts +1 -1
- package/dist/h5/dd-resizable.js +2 -1
- package/dist/h5/dd-resizable.js.map +1 -1
- package/dist/h5/dd-utils.d.ts +1 -1
- package/dist/h5/dd-utils.js +1 -1
- package/dist/h5/dd-utils.js.map +1 -1
- package/dist/h5/gridstack-dd-native.d.ts +1 -1
- package/dist/h5/gridstack-dd-native.js +1 -1
- package/dist/h5/gridstack-dd-native.js.map +1 -1
- package/dist/jq/gridstack-dd-jqueryui.js.map +1 -1
- package/dist/src/gridstack-extra.scss +7 -5
- package/dist/src/gridstack.scss +9 -7
- package/dist/types.d.ts +5 -2
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +3 -1
- package/dist/utils.js +7 -5
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +26 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -92,19 +92,28 @@ which means you can possibly bring your own version
|
|
|
92
92
|
},
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
Alternatively in html
|
|
95
|
+
Alternatively (single combined file) in html
|
|
96
96
|
|
|
97
97
|
```html
|
|
98
98
|
<link href="node_modules/gridstack/dist/gridstack.min.css" rel="stylesheet"/>
|
|
99
|
-
<!-- HTML5 drag&drop (
|
|
99
|
+
<!-- HTML5 drag&drop (70k) -->
|
|
100
100
|
<script src="node_modules/gridstack/dist/gridstack-h5.js"></script>
|
|
101
|
-
<!-- OR jquery-ui drag&drop (
|
|
101
|
+
<!-- OR jquery-ui drag&drop (195k) -->
|
|
102
102
|
<script src="node_modules/gridstack/dist/gridstack-jq.js"></script>
|
|
103
|
-
<!-- OR static grid (
|
|
103
|
+
<!-- OR static grid (40k) -->
|
|
104
104
|
<script src="node_modules/gridstack/dist/gridstack-static.js"></script>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
Note
|
|
107
|
+
**Note**: the API is the same, regardless of the plugin (or lack thereof) so you can switch at any time. The Jquery version will export $ that it bundles and currently the only one to support mobile/touch devices through `jquery.ui.touch-punch` (h5 version is planned). Read more at [migrating to v3](#migrating-to-v3)
|
|
108
|
+
|
|
109
|
+
**Note2**: IE support was dropped in v2, but restored in v4.4 by an external contributor (I have no interest in testing+supporting obsolete browser so this might break in the future).
|
|
110
|
+
You can use the es5 files and polyfill (larger) for older browser instead. For example:
|
|
111
|
+
```html
|
|
112
|
+
<link href="node_modules/gridstack/dist/gridstack.min.css" rel="stylesheet"/>
|
|
113
|
+
<script src="node_modules/gridstack/dist/es5/gridstack-poly.js"></script>
|
|
114
|
+
<script src="node_modules/gridstack/dist/es5/gridstack-jq.js"></script>
|
|
115
|
+
```
|
|
116
|
+
|
|
108
117
|
|
|
109
118
|
## Basic usage
|
|
110
119
|
|
|
@@ -189,10 +198,10 @@ GridStack.init( {column: N} );
|
|
|
189
198
|
```html
|
|
190
199
|
<link href="node_modules/gridstack/dist/gridstack-extra.css" rel="stylesheet"/>
|
|
191
200
|
|
|
192
|
-
<div class="grid-stack
|
|
201
|
+
<div class="grid-stack">...</div>
|
|
193
202
|
```
|
|
194
203
|
|
|
195
|
-
Note: class `.grid-stack-N`
|
|
204
|
+
Note: class `.grid-stack-N` will automatically be added and we include `gridstack-extra.css` which defines CSS for grids with custom [2-11] columns. Anything more and you'll need to generate the SASS/CSS yourself (see next).
|
|
196
205
|
|
|
197
206
|
See example: [2 grids demo](http://gridstack.github.io/gridstack.js/demo/two.html) with 6 columns
|
|
198
207
|
|
|
@@ -204,11 +213,11 @@ For instance for 3-column grid you need to rewrite CSS to be:
|
|
|
204
213
|
|
|
205
214
|
```css
|
|
206
215
|
.grid-stack-item[gs-w="3"] { width: 100% }
|
|
207
|
-
.grid-stack-item[gs-w="2"] { width: 66.
|
|
208
|
-
.grid-stack-item[gs-w="1"] { width: 33.
|
|
216
|
+
.grid-stack-item[gs-w="2"] { width: 66.67% }
|
|
217
|
+
.grid-stack-item[gs-w="1"] { width: 33.33% }
|
|
209
218
|
|
|
210
|
-
.grid-stack-item[gs-x="2"] { left: 66.
|
|
211
|
-
.grid-stack-item[gs-x="1"] { left: 33.
|
|
219
|
+
.grid-stack-item[gs-x="2"] { left: 66.67% }
|
|
220
|
+
.grid-stack-item[gs-x="1"] { left: 33.33% }
|
|
212
221
|
```
|
|
213
222
|
|
|
214
223
|
For 4-column grid it should be:
|
|
@@ -229,23 +238,23 @@ and so on.
|
|
|
229
238
|
Better yet, here is a SASS code snippet which can make life much easier (Thanks to @ascendantofrain, [#81](https://github.com/gridstack/gridstack.js/issues/81) and @StefanM98, [#868](https://github.com/gridstack/gridstack.js/issues/868)) and you can use sites like [sassmeister.com](https://www.sassmeister.com/) to generate the CSS for you instead:
|
|
230
239
|
|
|
231
240
|
```sass
|
|
241
|
+
@use "sass;math";
|
|
232
242
|
.grid-stack > .grid-stack-item {
|
|
233
243
|
|
|
234
244
|
$gridstack-columns: 12;
|
|
235
245
|
|
|
236
|
-
min-width: (100
|
|
246
|
+
min-width: math.div(100%, $gridstack-columns);
|
|
237
247
|
|
|
238
|
-
@for $i from
|
|
239
|
-
&[gs-w='#{$i}'] { width: (100
|
|
240
|
-
&[gs-x='#{$i}'] { left: (100
|
|
241
|
-
&[gs-min-w='#{$i}'] { min-width: (100
|
|
242
|
-
&[gs-max-w='#{$i}'] { max-width: (100
|
|
248
|
+
@for $i from 0 through $gridstack-columns {
|
|
249
|
+
&[gs-w='#{$i}'] { width: math.div(100%, $gridstack-columns) * $i; }
|
|
250
|
+
&[gs-x='#{$i}'] { left: math.div(100%, $gridstack-columns) * $i; }
|
|
251
|
+
&[gs-min-w='#{$i}'] { min-width: math.div(100%, $gridstack-columns) * $i; }
|
|
252
|
+
&[gs-max-w='#{$i}'] { max-width: math.div(100%, $gridstack-columns) * $i; }
|
|
243
253
|
}
|
|
244
254
|
}
|
|
245
255
|
```
|
|
246
256
|
|
|
247
|
-
you can also use the SASS [src/gridstack-extra.scss](https://github.com/gridstack/gridstack.js/tree/master/src/gridstack-extra.scss) included in NPM package and modify to add more columns
|
|
248
|
-
and also have the `.grid-stack-N` prefix to support letting the user change columns dynamically.
|
|
257
|
+
you can also use the SASS [src/gridstack-extra.scss](https://github.com/gridstack/gridstack.js/tree/master/src/gridstack-extra.scss) included in NPM package and modify to add more columns.
|
|
249
258
|
|
|
250
259
|
Sample gulp command for 30 columns:
|
|
251
260
|
```js
|
|
@@ -298,6 +307,7 @@ search for ['gridstack' under NPM](https://www.npmjs.com/search?q=gridstack&rank
|
|
|
298
307
|
- **Rails**: [gridstack-js-rails](https://github.com/randoum/gridstack-js-rails)
|
|
299
308
|
- **React**: see [demo](https://gridstackjs.com/demo/react.html) with [src](https://github.com/gridstack/gridstack.js/tree/master/demo/react.html), or [react-gridstack-example](https://github.com/Inder2108/react-gridstack-example/tree/master/src/App.js), or read on what [hooks to use](https://github.com/gridstack/gridstack.js/issues/735#issuecomment-329888796)
|
|
300
309
|
- **Vue**: see [demo](https://gridstackjs.com/demo/vue3js.html) with [v3 src](https://github.com/gridstack/gridstack.js/tree/master/demo/vue3js.html) or [v2 src](https://github.com/gridstack/gridstack.js/tree/master/demo/vue2js.html)
|
|
310
|
+
- **Aurelia**: [aurelia-gridstack](https://github.com/aurelia-ui-toolkits/aurelia-gridstack), see [demo](https://aurelia-ui-toolkits.github.io/aurelia-gridstack/)
|
|
301
311
|
|
|
302
312
|
# Migrating
|
|
303
313
|
## Migrating to v0.6
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gridstack-dd.ts 4.4.0
|
|
3
|
+
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
|
|
4
|
+
*/
|
|
5
|
+
import { GridStackDDI } from './gridstack-ddi';
|
|
6
|
+
import { GridItemHTMLElement, GridStackElement, DDDragInOpt } from './types';
|
|
7
|
+
/** Drag&Drop drop options */
|
|
8
|
+
export declare type DDDropOpt = {
|
|
9
|
+
/** function or class type that this grid will accept as dropped items (see GridStackOptions.acceptWidgets) */
|
|
10
|
+
accept?: (el: GridItemHTMLElement) => boolean;
|
|
11
|
+
};
|
|
12
|
+
/** drag&drop options currently called from the main code, but others can be passed in grid options */
|
|
13
|
+
export declare type DDOpts = 'enable' | 'disable' | 'destroy' | 'option' | string | any;
|
|
14
|
+
export declare type DDKey = 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight';
|
|
15
|
+
export declare type DDValue = number | string;
|
|
16
|
+
/** drag&drop events callbacks */
|
|
17
|
+
export declare type DDCallback = (event: Event, arg2: GridItemHTMLElement, helper?: GridItemHTMLElement) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Base class implementing common Grid drag'n'drop functionality, with domain specific subclass (h5 vs jq subclasses)
|
|
20
|
+
*/
|
|
21
|
+
export declare abstract class GridStackDD extends GridStackDDI {
|
|
22
|
+
/** override to cast to correct type */
|
|
23
|
+
static get(): GridStackDD;
|
|
24
|
+
/** removes any drag&drop present (called during destroy) */
|
|
25
|
+
remove(el: GridItemHTMLElement): GridStackDD;
|
|
26
|
+
abstract resizable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDD;
|
|
27
|
+
abstract isResizable(el: HTMLElement): boolean;
|
|
28
|
+
abstract draggable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): GridStackDD;
|
|
29
|
+
abstract dragIn(el: GridStackElement, opts: DDDragInOpt): GridStackDD;
|
|
30
|
+
abstract isDraggable(el: HTMLElement): boolean;
|
|
31
|
+
abstract droppable(el: GridItemHTMLElement, opts: DDOpts | DDDropOpt, key?: DDKey, value?: DDValue): GridStackDD;
|
|
32
|
+
abstract isDroppable(el: HTMLElement): boolean;
|
|
33
|
+
abstract on(el: GridItemHTMLElement, eventName: string, callback: DDCallback): GridStackDD;
|
|
34
|
+
abstract off(el: GridItemHTMLElement, eventName: string): GridStackDD;
|
|
35
|
+
}
|