gridstack 4.3.0 → 5.0.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.
Files changed (126) hide show
  1. package/README.md +22 -5
  2. package/dist/es5/gridstack-dd.d.ts +35 -0
  3. package/dist/es5/gridstack-dd.js +686 -0
  4. package/dist/es5/gridstack-dd.js.map +1 -0
  5. package/dist/es5/gridstack-ddi.d.ts +17 -0
  6. package/dist/es5/gridstack-ddi.js +31 -0
  7. package/dist/es5/gridstack-ddi.js.map +1 -0
  8. package/dist/es5/gridstack-engine.d.ts +93 -0
  9. package/dist/es5/gridstack-engine.js +955 -0
  10. package/dist/es5/gridstack-engine.js.map +1 -0
  11. package/dist/es5/gridstack-h5.d.ts +10 -0
  12. package/dist/es5/gridstack-h5.js +3 -0
  13. package/dist/es5/gridstack-h5.js.LICENSE.txt +7 -0
  14. package/dist/es5/gridstack-h5.js.map +1 -0
  15. package/dist/es5/gridstack-jq.d.ts +10 -0
  16. package/dist/es5/gridstack-jq.js +3 -0
  17. package/dist/es5/gridstack-jq.js.LICENSE.txt +99 -0
  18. package/dist/es5/gridstack-jq.js.map +1 -0
  19. package/dist/{gridstack-poly.js → es5/gridstack-poly.js} +154 -3
  20. package/dist/es5/gridstack-static.d.ts +9 -0
  21. package/dist/es5/gridstack-static.js +3 -0
  22. package/dist/es5/gridstack-static.js.LICENSE.txt +7 -0
  23. package/dist/es5/gridstack-static.js.map +1 -0
  24. package/dist/es5/gridstack.d.ts +346 -0
  25. package/dist/es5/gridstack.js +1517 -0
  26. package/dist/es5/gridstack.js.map +1 -0
  27. package/dist/es5/h5/dd-base-impl.d.ts +20 -0
  28. package/dist/es5/h5/dd-base-impl.js +43 -0
  29. package/dist/es5/h5/dd-base-impl.js.map +1 -0
  30. package/dist/es5/h5/dd-draggable.d.ts +29 -0
  31. package/dist/es5/h5/dd-draggable.js +329 -0
  32. package/dist/es5/h5/dd-draggable.js.map +1 -0
  33. package/dist/es5/h5/dd-droppable.d.ts +24 -0
  34. package/dist/es5/h5/dd-droppable.js +199 -0
  35. package/dist/es5/h5/dd-droppable.js.map +1 -0
  36. package/dist/es5/h5/dd-element.d.ts +27 -0
  37. package/dist/es5/h5/dd-element.js +96 -0
  38. package/dist/es5/h5/dd-element.js.map +1 -0
  39. package/dist/es5/h5/dd-manager.d.ts +8 -0
  40. package/dist/es5/h5/dd-manager.js +14 -0
  41. package/dist/es5/h5/dd-manager.js.map +1 -0
  42. package/dist/es5/h5/dd-resizable-handle.d.ts +14 -0
  43. package/dist/es5/h5/dd-resizable-handle.js +83 -0
  44. package/dist/es5/h5/dd-resizable-handle.js.map +1 -0
  45. package/dist/es5/h5/dd-resizable.d.ts +28 -0
  46. package/dist/es5/h5/dd-resizable.js +301 -0
  47. package/dist/es5/h5/dd-resizable.js.map +1 -0
  48. package/dist/es5/h5/dd-utils.d.ts +19 -0
  49. package/dist/es5/h5/dd-utils.js +111 -0
  50. package/dist/es5/h5/dd-utils.js.map +1 -0
  51. package/dist/es5/h5/gridstack-dd-native.d.ts +26 -0
  52. package/dist/es5/h5/gridstack-dd-native.js +175 -0
  53. package/dist/es5/h5/gridstack-dd-native.js.map +1 -0
  54. package/dist/es5/jq/gridstack-dd-jqueryui.d.ts +22 -0
  55. package/dist/es5/jq/gridstack-dd-jqueryui.js +162 -0
  56. package/dist/es5/jq/gridstack-dd-jqueryui.js.map +1 -0
  57. package/dist/es5/types.d.ts +263 -0
  58. package/dist/es5/types.js +7 -0
  59. package/dist/es5/types.js.map +1 -0
  60. package/dist/es5/utils.d.ts +73 -0
  61. package/dist/es5/utils.js +445 -0
  62. package/dist/es5/utils.js.map +1 -0
  63. package/dist/gridstack-dd.d.ts +1 -1
  64. package/dist/gridstack-dd.js +27 -16
  65. package/dist/gridstack-dd.js.map +1 -1
  66. package/dist/gridstack-ddi.d.ts +1 -1
  67. package/dist/gridstack-ddi.js +1 -1
  68. package/dist/gridstack-ddi.js.map +1 -1
  69. package/dist/gridstack-engine.d.ts +3 -2
  70. package/dist/gridstack-engine.js +83 -53
  71. package/dist/gridstack-engine.js.map +1 -1
  72. package/dist/gridstack-h5.d.ts +1 -1
  73. package/dist/gridstack-h5.js +1 -1
  74. package/dist/gridstack-h5.js.LICENSE.txt +1 -1
  75. package/dist/gridstack-h5.js.map +1 -1
  76. package/dist/gridstack-jq.d.ts +1 -1
  77. package/dist/gridstack-jq.js +1 -1
  78. package/dist/gridstack-jq.js.LICENSE.txt +1 -1
  79. package/dist/gridstack-jq.js.map +1 -1
  80. package/dist/gridstack-static.d.ts +1 -1
  81. package/dist/gridstack-static.js +1 -1
  82. package/dist/gridstack-static.js.LICENSE.txt +1 -1
  83. package/dist/gridstack-static.js.map +1 -1
  84. package/dist/gridstack.css +1 -5
  85. package/dist/gridstack.d.ts +2 -2
  86. package/dist/gridstack.js +81 -44
  87. package/dist/gridstack.js.map +1 -1
  88. package/dist/gridstack.min.css +1 -1
  89. package/dist/h5/dd-base-impl.d.ts +1 -1
  90. package/dist/h5/dd-base-impl.js +1 -1
  91. package/dist/h5/dd-base-impl.js.map +1 -1
  92. package/dist/h5/dd-draggable.d.ts +1 -2
  93. package/dist/h5/dd-draggable.js +26 -16
  94. package/dist/h5/dd-draggable.js.map +1 -1
  95. package/dist/h5/dd-droppable.d.ts +2 -1
  96. package/dist/h5/dd-droppable.js +42 -25
  97. package/dist/h5/dd-droppable.js.map +1 -1
  98. package/dist/h5/dd-element.d.ts +1 -1
  99. package/dist/h5/dd-element.js +1 -1
  100. package/dist/h5/dd-element.js.map +1 -1
  101. package/dist/h5/dd-manager.d.ts +1 -1
  102. package/dist/h5/dd-manager.js +1 -1
  103. package/dist/h5/dd-manager.js.map +1 -1
  104. package/dist/h5/dd-resizable-handle.d.ts +1 -1
  105. package/dist/h5/dd-resizable-handle.js +1 -1
  106. package/dist/h5/dd-resizable-handle.js.map +1 -1
  107. package/dist/h5/dd-resizable.d.ts +1 -2
  108. package/dist/h5/dd-resizable.js +3 -3
  109. package/dist/h5/dd-resizable.js.map +1 -1
  110. package/dist/h5/dd-utils.d.ts +3 -1
  111. package/dist/h5/dd-utils.js +13 -1
  112. package/dist/h5/dd-utils.js.map +1 -1
  113. package/dist/h5/gridstack-dd-native.d.ts +1 -1
  114. package/dist/h5/gridstack-dd-native.js +1 -1
  115. package/dist/h5/gridstack-dd-native.js.map +1 -1
  116. package/dist/jq/gridstack-dd-jqueryui.js.map +1 -1
  117. package/dist/src/gridstack.scss +6 -5
  118. package/dist/types.d.ts +12 -4
  119. package/dist/types.js +1 -1
  120. package/dist/types.js.map +1 -1
  121. package/dist/utils.d.ts +4 -2
  122. package/dist/utils.js +7 -6
  123. package/dist/utils.js.map +1 -1
  124. package/doc/CHANGES.md +24 -0
  125. package/doc/README.md +10 -5
  126. package/package.json +5 -3
package/README.md CHANGED
@@ -44,6 +44,7 @@ Join us on Slack: https://gridstackjs.troolee.com
44
44
  - [Migrating to v2](#migrating-to-v2)
45
45
  - [Migrating to v3](#migrating-to-v3)
46
46
  - [Migrating to v4](#migrating-to-v4)
47
+ - [Migrating to v5](#migrating-to-v5)
47
48
  - [jQuery Application](#jquery-application)
48
49
  - [Changes](#changes)
49
50
  - [The Team](#the-team)
@@ -92,19 +93,28 @@ which means you can possibly bring your own version
92
93
  },
93
94
  ```
94
95
 
95
- Alternatively in html
96
+ Alternatively (single combined file) in html
96
97
 
97
98
  ```html
98
99
  <link href="node_modules/gridstack/dist/gridstack.min.css" rel="stylesheet"/>
99
- <!-- HTML5 drag&drop (68k) -->
100
+ <!-- HTML5 drag&drop (70k) -->
100
101
  <script src="node_modules/gridstack/dist/gridstack-h5.js"></script>
101
- <!-- OR jquery-ui drag&drop (193k) -->
102
+ <!-- OR jquery-ui drag&drop (195k) -->
102
103
  <script src="node_modules/gridstack/dist/gridstack-jq.js"></script>
103
- <!-- OR static grid (38k) -->
104
+ <!-- OR static grid (40k) -->
104
105
  <script src="node_modules/gridstack/dist/gridstack-static.js"></script>
105
106
  ```
106
107
 
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
+ **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)
109
+
110
+ **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).
111
+ You can use the es5 files and polyfill (larger) for older browser instead. For example:
112
+ ```html
113
+ <link href="node_modules/gridstack/dist/gridstack.min.css" rel="stylesheet"/>
114
+ <script src="node_modules/gridstack/dist/es5/gridstack-poly.js"></script>
115
+ <script src="node_modules/gridstack/dist/es5/gridstack-jq.js"></script>
116
+ ```
117
+
108
118
 
109
119
  ## Basic usage
110
120
 
@@ -426,6 +436,13 @@ v4 is a complete re-write of the collision and drag in/out heuristics to fix som
426
436
  `locked()`, `maxWidth()`, `minWidth()`, `maxHeight()`, `minHeight()`, `move()`, `resize()`
427
437
 
428
438
 
439
+ ## Migrating to v5
440
+
441
+ make sure to read v4 migration first!
442
+
443
+ v5 does not have any breaking changes from v4, but a focus on nested grids in h5 mode:
444
+ You can now drag in/out of parent into nested child, with new API parameters values. See the release notes.
445
+
429
446
  # jQuery Application
430
447
 
431
448
  We now have a native HTML5 drag'n'drop through the plugin system (default), but the jquery-ui version can be used instead. It will bundle `jquery` (3.5.1) + `jquery-ui` (1.12.1 minimal drag|drop|resize) + `jquery-ui-touch-punch` (1.0.8 for mobile support) in `gridstack-jq.js`.
@@ -0,0 +1,35 @@
1
+ /**
2
+ * gridstack-dd.ts 5.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
+ }