gridstack 9.5.1 → 10.0.1

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.
Files changed (114) hide show
  1. package/README.md +11 -1
  2. package/angular/package.json +1 -1
  3. package/angular/projects/demo/src/app/app.component.ts +0 -2
  4. package/angular/projects/lib/package.json +1 -1
  5. package/angular/projects/lib/src/lib/base-widget.ts +1 -1
  6. package/angular/projects/lib/src/lib/gridstack-item.component.ts +1 -1
  7. package/angular/projects/lib/src/lib/gridstack.component.ts +1 -1
  8. package/angular/projects/lib/src/lib/gridstack.module.ts +1 -1
  9. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  10. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  11. package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
  12. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  13. package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
  14. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  15. package/dist/angular/fesm2020/gridstack-angular.mjs +4 -4
  16. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  17. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  18. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  19. package/dist/angular/package.json +1 -1
  20. package/dist/angular/src/base-widget.ts +1 -1
  21. package/dist/angular/src/gridstack-item.component.ts +1 -1
  22. package/dist/angular/src/gridstack.component.ts +1 -1
  23. package/dist/angular/src/gridstack.module.ts +1 -1
  24. package/dist/dd-base-impl.d.ts +1 -1
  25. package/dist/dd-base-impl.js +1 -1
  26. package/dist/dd-base-impl.js.map +1 -1
  27. package/dist/dd-draggable.d.ts +1 -1
  28. package/dist/dd-draggable.js +1 -1
  29. package/dist/dd-draggable.js.map +1 -1
  30. package/dist/dd-droppable.d.ts +1 -1
  31. package/dist/dd-droppable.js +1 -1
  32. package/dist/dd-droppable.js.map +1 -1
  33. package/dist/dd-element.d.ts +1 -1
  34. package/dist/dd-element.js +1 -1
  35. package/dist/dd-element.js.map +1 -1
  36. package/dist/dd-gridstack.d.ts +1 -1
  37. package/dist/dd-gridstack.js +1 -1
  38. package/dist/dd-gridstack.js.map +1 -1
  39. package/dist/dd-manager.d.ts +1 -1
  40. package/dist/dd-manager.js +1 -1
  41. package/dist/dd-manager.js.map +1 -1
  42. package/dist/dd-resizable-handle.d.ts +1 -1
  43. package/dist/dd-resizable-handle.js +1 -1
  44. package/dist/dd-resizable-handle.js.map +1 -1
  45. package/dist/dd-resizable.d.ts +1 -1
  46. package/dist/dd-resizable.js +1 -1
  47. package/dist/dd-resizable.js.map +1 -1
  48. package/dist/dd-touch.d.ts +1 -1
  49. package/dist/dd-touch.js +1 -1
  50. package/dist/dd-touch.js.map +1 -1
  51. package/dist/es5/dd-base-impl.d.ts +1 -1
  52. package/dist/es5/dd-base-impl.js +1 -1
  53. package/dist/es5/dd-base-impl.js.map +1 -1
  54. package/dist/es5/dd-draggable.d.ts +1 -1
  55. package/dist/es5/dd-draggable.js +1 -1
  56. package/dist/es5/dd-draggable.js.map +1 -1
  57. package/dist/es5/dd-droppable.d.ts +1 -1
  58. package/dist/es5/dd-droppable.js +1 -1
  59. package/dist/es5/dd-droppable.js.map +1 -1
  60. package/dist/es5/dd-element.d.ts +1 -1
  61. package/dist/es5/dd-element.js +1 -1
  62. package/dist/es5/dd-element.js.map +1 -1
  63. package/dist/es5/dd-gridstack.d.ts +1 -1
  64. package/dist/es5/dd-gridstack.js +1 -1
  65. package/dist/es5/dd-gridstack.js.map +1 -1
  66. package/dist/es5/dd-manager.d.ts +1 -1
  67. package/dist/es5/dd-manager.js +1 -1
  68. package/dist/es5/dd-manager.js.map +1 -1
  69. package/dist/es5/dd-resizable-handle.d.ts +1 -1
  70. package/dist/es5/dd-resizable-handle.js +1 -1
  71. package/dist/es5/dd-resizable-handle.js.map +1 -1
  72. package/dist/es5/dd-resizable.d.ts +1 -1
  73. package/dist/es5/dd-resizable.js +1 -1
  74. package/dist/es5/dd-resizable.js.map +1 -1
  75. package/dist/es5/dd-touch.d.ts +1 -1
  76. package/dist/es5/dd-touch.js +1 -1
  77. package/dist/es5/dd-touch.js.map +1 -1
  78. package/dist/es5/gridstack-all.js +1 -1
  79. package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
  80. package/dist/es5/gridstack-all.js.map +1 -1
  81. package/dist/es5/gridstack-engine.d.ts +1 -1
  82. package/dist/es5/gridstack-engine.js +1 -1
  83. package/dist/es5/gridstack-engine.js.map +1 -1
  84. package/dist/es5/gridstack-poly.js +1 -1
  85. package/dist/es5/gridstack.d.ts +11 -7
  86. package/dist/es5/gridstack.js +183 -127
  87. package/dist/es5/gridstack.js.map +1 -1
  88. package/dist/es5/types.d.ts +27 -13
  89. package/dist/es5/types.js +1 -4
  90. package/dist/es5/types.js.map +1 -1
  91. package/dist/es5/utils.d.ts +2 -2
  92. package/dist/es5/utils.js +4 -3
  93. package/dist/es5/utils.js.map +1 -1
  94. package/dist/gridstack-all.js +1 -1
  95. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  96. package/dist/gridstack-all.js.map +1 -1
  97. package/dist/gridstack-engine.d.ts +1 -1
  98. package/dist/gridstack-engine.js +1 -1
  99. package/dist/gridstack-engine.js.map +1 -1
  100. package/dist/gridstack.css +2 -2
  101. package/dist/gridstack.d.ts +11 -7
  102. package/dist/gridstack.js +180 -124
  103. package/dist/gridstack.js.map +1 -1
  104. package/dist/gridstack.min.css +1 -1
  105. package/dist/src/gridstack.scss +2 -2
  106. package/dist/types.d.ts +27 -13
  107. package/dist/types.js +1 -4
  108. package/dist/types.js.map +1 -1
  109. package/dist/utils.d.ts +2 -2
  110. package/dist/utils.js +4 -3
  111. package/dist/utils.js.map +1 -1
  112. package/doc/CHANGES.md +15 -1
  113. package/doc/README.md +23 -10
  114. package/package.json +2 -2
package/doc/README.md CHANGED
@@ -6,6 +6,8 @@ gridstack.js API
6
6
  **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
7
7
 
8
8
  - [Grid Options](#grid-options)
9
+ - [Responsive](#responsive)
10
+ - [Breakpoint](#breakpoint)
9
11
  - [DDDragOpt](#dddragopt)
10
12
  - [DDDragInOpt extends DDDragOpt](#dddraginopt-extends-dddragopt)
11
13
  - [Grid attributes](#grid-attributes)
@@ -51,7 +53,7 @@ gridstack.js API
51
53
  - [`isAreaEmpty(x, y, width, height)`](#isareaemptyx-y-width-height)
52
54
  - [`load(layout: GridStackWidget[], boolean | ((w: GridStackWidget, add: boolean) => void) = true)`](#loadlayout-gridstackwidget-boolean--w-gridstackwidget-add-boolean--void---true)
53
55
  - [`makeWidget(el)`](#makewidgetel)
54
- - [`makeSubgrid(el)`](#makesubgridel)
56
+ - [`makeSubGrid(el)`](#makesubgridel)
55
57
  - [`margin(value: numberOrString)`](#marginvalue-numberorstring)
56
58
  - [`movable(el, val)`](#movableel-val)
57
59
  - [`removeWidget(el, removeDOM = true, triggerEvent = true)`](#removewidgetel-removedom--true-triggerevent--true)
@@ -93,9 +95,9 @@ gridstack.js API
93
95
  * A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!
94
96
  - `children`?: GridStackWidget[] - list of children item to create when calling load() or addGrid()
95
97
  - `column` - Integer > 0 (default 12) which can change on the fly with `column(N)` API, or `'auto'` for nested grids to size themselves to the parent grid container (to make sub-items are the same size). See [column](http://gridstackjs.com/demo/column.html) and [nested](http://gridstackjs.com/demo/nested.html)
98
+ - `columnOpts`?:Responsive - describes the responsive nature of the column grid. see `Responsive` interface.
96
99
  - `class`?: string - additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance
97
100
  - `disableDrag` - disallows dragging of widgets (default: `false`).
98
- - `disableOneColumnMode` - Prevents the grid container from being displayed in "one column mode", even when the container's width is smaller than the value of oneColumnSize (default value of oneColumnSize is 768px). By default, this option is set to "false".
99
101
  - `disableResize` - disallows resizing of widgets (default: `false`).
100
102
  - `draggable` - allows to override draggable options - see `DDDragOpt`. (default: `{handle: '.grid-stack-item-content', appendTo: 'body', scroll: true}`)
101
103
  - `dragOut` to let user drag nested grid items out of a parent or not (default false) See [example](http://gridstackjs.com/demo/nested.html)
@@ -115,9 +117,7 @@ gridstack.js API
115
117
  - `maxRow` - maximum rows amount. Default is `0` which means no max.
116
118
  - `minRow` - minimum rows amount which is handy to prevent grid from collapsing when empty. Default is `0`. You can also do this with `min-height` CSS attribute on the grid div in pixels, which will round to the closest row.
117
119
  - `nonce` - If you are using a nonce-based Content Security Policy, pass your nonce here and
118
- GridStack will add it to the <style> elements it creates.
119
- - `oneColumnSize` - When the width of the grid is equal to or less than the value set in oneColumnSize, the grid will be displayed in one-column mode. By default, the value of this option is set to "768".
120
- - `oneColumnModeDomSort` - set to `true` if you want oneColumnMode to use the DOM order and ignore x,y from normal multi column layouts during sorting. This enables you to have custom 1 column layout that differ from the rest. (default?: `false`)
120
+ GridStack will add it to the `<style>` elements it creates.
121
121
  - `placeholderClass` - class for placeholder (default: `'grid-stack-placeholder'`)
122
122
  - `placeholderText` - placeholder default content (default: `''`)
123
123
  - `resizable` - allows to override resizable options. (default: `{handles: 'se'}`). `handles` can be any combo of `n,ne,e,se,s,sw,w,nw` or `all`.
@@ -128,6 +128,19 @@ GridStack will add it to the <style> elements it creates.
128
128
  - `staticGrid` - removes drag|drop|resize (default `false`). If `true` widgets are not movable/resizable by the user, but code can still move and oneColumnMode will still work. You can use the smaller gridstack-static.js lib. A CSS class `grid-stack-static` is also added to the container.
129
129
  - `styleInHead` - if `true` will add style element to `<head>` otherwise will add it to element's parent node (default `false`).
130
130
 
131
+ ### Responsive
132
+ v10.x supports a much richer responsive behavior, you can have breakpoints of width:column, or auto column sizing, where no code is longer needed.
133
+ - `columnWidth`?: number - wanted width to maintain (+-50%) to dynamically pick a column count
134
+ - `columnMax`?: number - maximum number of columns allowed (default: 12). Note: make sure to have correct CSS to support this.
135
+ - `layout`?: ColumnOptions - global re-layout mode when changing columns
136
+ - `breakpointForWindow`?: boolean - specify if breakpoints are for window size or grid size (default:false = grid)
137
+ - `breakpoints`?: Breakpoint[] - explicit width:column breakpoints instead of automatic 'columnWidth'. Note: make sure to have correct CSS to support this.
138
+
139
+ #### Breakpoint
140
+ - `w`?: number - width
141
+ - `c`: number - column
142
+ - `layout`?: ColumnOptions - re-layout mode if different from global one
143
+
131
144
  ### DDDragOpt
132
145
  - `handle`?: string - class selector of items that can be dragged. default to '.grid-stack-item-content'
133
146
  - `appendTo`?: string - default to 'body' (TODO: is this even used anymore ?)
@@ -136,7 +149,7 @@ GridStack will add it to the <style> elements it creates.
136
149
  - `cancel`?: string - prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option'
137
150
 
138
151
  ### DDDragInOpt extends DDDragOpt
139
- - `helper`?: 'clone' | ((event: Event) => HTMLElement) - helper function when dropping (ex: 'clone' or your own method)
152
+ - `helper`?: 'clone' | ((event: Event) => HTMLElement) - helper function when dropping (ex: 'clone' or your own method)
140
153
 
141
154
  ## Grid attributes
142
155
 
@@ -321,7 +334,7 @@ let grids = GridStack.initAll();
321
334
  grids.forEach(...)
322
335
  ```
323
336
 
324
- ### `addGrid(parent: HTMLElement, opt: GridStackOptions = {}): GridStack `
337
+ ### `addGrid(parent: HTMLElement, opt: GridStackOptions = {}): GridStack `
325
338
 
326
339
  * call to create a grid with the given options, including loading any children from JSON structure. This will call `GridStack.init()`, then `grid.load()` on any passed children (recursively). Great alternative to calling `init()` if you want entire grid to come from JSON serialized data, including options.
327
340
  * @param parent HTML element parent to the grid
@@ -372,7 +385,7 @@ re-layout grid items to reclaim any empty space. Options are:
372
385
  - `'compact'` might re-order items to fill any empty space
373
386
 
374
387
  - `doSort` - `false` to let you do your own sorting ahead in case you need to control a different order. (default to sort)
375
-
388
+
376
389
 
377
390
  ### `cellHeight(val: number, update = true)`
378
391
 
@@ -509,7 +522,7 @@ let grid = GridStack.init();
509
522
  grid.el.appendChild('<div id="gsi-1" gs-x="0" gs-y="0" gs-w="3" gs-h="2" gs-auto-position="true"></div>')
510
523
  grid.makeWidget('#gsi-1');
511
524
  ```
512
- ### `makeSubgrid(el)`
525
+ ### `makeSubGrid(el)`
513
526
  Used to add a subgrid into an existing grid.
514
527
  ```js
515
528
  const grid = Gridstack.init()
@@ -520,7 +533,7 @@ grid.el.appendChild(`
520
533
  </div>
521
534
  </div>
522
535
  </div>`)
523
- grid.addSubGrid(grid.el.getElementById('nested-grid'))
536
+ grid.makeSubGrid(grid.el.getElementById('nested-grid'))
524
537
  ```
525
538
  Make sure that the subgrid is inside of a grid item. It is important to remember that subgrids are themselves grid items capable of containing other grid items.
526
539
  ### `margin(value: numberOrString)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridstack",
3
- "version": "9.5.1",
3
+ "version": "10.0.1",
4
4
  "license": "MIT",
5
5
  "author": "Alain Dumesny <alaind831+github@gmail.com> (https://github.com/adumesny)",
6
6
  "contributors": [
@@ -83,7 +83,7 @@
83
83
  "karma-chrome-launcher": "^3.1.1",
84
84
  "karma-cli": "^2.0.0",
85
85
  "karma-jasmine": "^5.1.0",
86
- "karma-typescript": "5.5.3",
86
+ "karma-typescript": "5.5.4",
87
87
  "protractor": "^7.0.0",
88
88
  "sass": "^1.62.0",
89
89
  "serve-static": "^1.15.0",