gridstack 7.3.0 → 8.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 (196) hide show
  1. package/README.md +9 -2
  2. package/dist/dd-base-impl.d.ts +20 -20
  3. package/dist/dd-base-impl.js +31 -35
  4. package/dist/dd-base-impl.js.map +1 -1
  5. package/dist/dd-draggable.d.ts +28 -28
  6. package/dist/dd-draggable.js +336 -344
  7. package/dist/dd-draggable.js.map +1 -1
  8. package/dist/dd-droppable.d.ts +26 -26
  9. package/dist/dd-droppable.js +146 -148
  10. package/dist/dd-droppable.js.map +1 -1
  11. package/dist/dd-element.d.ts +27 -27
  12. package/dist/dd-element.js +90 -94
  13. package/dist/dd-element.js.map +1 -1
  14. package/dist/dd-gridstack.d.ts +34 -34
  15. package/dist/dd-gridstack.js +127 -124
  16. package/dist/dd-gridstack.js.map +1 -1
  17. package/dist/dd-manager.d.ts +22 -22
  18. package/dist/dd-manager.js +9 -13
  19. package/dist/dd-manager.js.map +1 -1
  20. package/dist/dd-resizable-handle.d.ts +14 -14
  21. package/dist/dd-resizable-handle.js +102 -105
  22. package/dist/dd-resizable-handle.js.map +1 -1
  23. package/dist/dd-resizable.d.ts +28 -28
  24. package/dist/dd-resizable.js +290 -296
  25. package/dist/dd-resizable.js.map +1 -1
  26. package/dist/dd-touch.d.ts +33 -33
  27. package/dist/dd-touch.js +173 -182
  28. package/dist/dd-touch.js.map +1 -1
  29. package/dist/es5/dd-base-impl.d.ts +20 -20
  30. package/dist/es5/dd-base-impl.js +40 -40
  31. package/dist/es5/dd-base-impl.js.map +1 -1
  32. package/dist/es5/dd-draggable.d.ts +28 -28
  33. package/dist/es5/dd-draggable.js +366 -367
  34. package/dist/es5/dd-draggable.js.map +1 -1
  35. package/dist/es5/dd-droppable.d.ts +26 -26
  36. package/dist/es5/dd-droppable.js +181 -179
  37. package/dist/es5/dd-droppable.js.map +1 -1
  38. package/dist/es5/dd-element.d.ts +27 -27
  39. package/dist/es5/dd-element.js +95 -95
  40. package/dist/es5/dd-element.js.map +1 -1
  41. package/dist/es5/dd-gridstack.d.ts +34 -34
  42. package/dist/es5/dd-gridstack.js +144 -144
  43. package/dist/es5/dd-gridstack.js.map +1 -1
  44. package/dist/es5/dd-manager.d.ts +22 -22
  45. package/dist/es5/dd-manager.js +16 -16
  46. package/dist/es5/dd-manager.js.map +1 -1
  47. package/dist/es5/dd-resizable-handle.d.ts +14 -14
  48. package/dist/es5/dd-resizable-handle.js +105 -106
  49. package/dist/es5/dd-resizable-handle.js.map +1 -1
  50. package/dist/es5/dd-resizable.d.ts +28 -28
  51. package/dist/es5/dd-resizable.js +317 -318
  52. package/dist/es5/dd-resizable.js.map +1 -1
  53. package/dist/es5/dd-touch.d.ts +33 -33
  54. package/dist/es5/dd-touch.js +185 -185
  55. package/dist/es5/dd-touch.js.map +1 -1
  56. package/dist/es5/gridstack-all.js +1 -1
  57. package/dist/es5/gridstack-all.js.LICENSE.txt +1 -1
  58. package/dist/es5/gridstack-all.js.map +1 -1
  59. package/dist/es5/gridstack-engine.d.ts +102 -102
  60. package/dist/es5/gridstack-engine.js +1000 -995
  61. package/dist/es5/gridstack-engine.js.map +1 -1
  62. package/dist/es5/gridstack-poly.js +1 -1
  63. package/dist/es5/gridstack.d.ts +392 -376
  64. package/dist/es5/gridstack.js +2254 -2233
  65. package/dist/es5/gridstack.js.map +1 -1
  66. package/dist/es5/types.d.ts +279 -284
  67. package/dist/es5/types.js +47 -35
  68. package/dist/es5/types.js.map +1 -1
  69. package/dist/es5/utils.d.ts +95 -93
  70. package/dist/es5/utils.js +600 -569
  71. package/dist/es5/utils.js.map +1 -1
  72. package/dist/gridstack-all.js +1 -1
  73. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  74. package/dist/gridstack-all.js.map +1 -1
  75. package/dist/gridstack-engine.d.ts +102 -102
  76. package/dist/gridstack-engine.js +950 -954
  77. package/dist/gridstack-engine.js.map +1 -1
  78. package/dist/gridstack-extra.css +0 -390
  79. package/dist/gridstack-extra.min.css +1 -1
  80. package/dist/gridstack.css +19 -97
  81. package/dist/gridstack.d.ts +392 -376
  82. package/dist/gridstack.js +2155 -2157
  83. package/dist/gridstack.js.map +1 -1
  84. package/dist/gridstack.min.css +1 -1
  85. package/dist/ng/README.md +154 -0
  86. package/dist/ng/gridstack-item.component.d.ts +29 -0
  87. package/dist/ng/gridstack-item.component.js +65 -0
  88. package/dist/ng/gridstack-item.component.js.map +1 -0
  89. package/dist/ng/gridstack.component.d.ts +118 -0
  90. package/dist/ng/gridstack.component.js +245 -0
  91. package/dist/ng/gridstack.component.js.map +1 -0
  92. package/dist/src/gridstack-extra.scss +0 -2
  93. package/dist/src/gridstack.scss +14 -9
  94. package/dist/types.d.ts +279 -284
  95. package/dist/types.js +44 -35
  96. package/dist/types.js.map +1 -1
  97. package/dist/utils.d.ts +95 -93
  98. package/dist/utils.js +546 -527
  99. package/dist/utils.js.map +1 -1
  100. package/{dist → dist_save}/angular/gridstack-item.component.ts +5 -3
  101. package/{dist → dist_save}/angular/gridstack.component.ts +32 -18
  102. package/dist_save/dd-base-impl.d.ts +20 -0
  103. package/dist_save/dd-base-impl.js +36 -0
  104. package/dist_save/dd-base-impl.js.map +1 -0
  105. package/dist_save/dd-draggable.d.ts +28 -0
  106. package/dist_save/dd-draggable.js +343 -0
  107. package/dist_save/dd-draggable.js.map +1 -0
  108. package/dist_save/dd-droppable.d.ts +26 -0
  109. package/dist_save/dd-droppable.js +149 -0
  110. package/dist_save/dd-droppable.js.map +1 -0
  111. package/dist_save/dd-element.d.ts +27 -0
  112. package/dist_save/dd-element.js +95 -0
  113. package/dist_save/dd-element.js.map +1 -0
  114. package/dist_save/dd-gridstack.d.ts +34 -0
  115. package/dist_save/dd-gridstack.js +125 -0
  116. package/dist_save/dd-gridstack.js.map +1 -0
  117. package/dist_save/dd-manager.d.ts +22 -0
  118. package/dist_save/dd-manager.js +14 -0
  119. package/dist_save/dd-manager.js.map +1 -0
  120. package/dist_save/dd-resizable-handle.d.ts +14 -0
  121. package/dist_save/dd-resizable-handle.js +106 -0
  122. package/dist_save/dd-resizable-handle.js.map +1 -0
  123. package/dist_save/dd-resizable.d.ts +28 -0
  124. package/dist_save/dd-resizable.js +294 -0
  125. package/dist_save/dd-resizable.js.map +1 -0
  126. package/dist_save/dd-touch.d.ts +33 -0
  127. package/dist_save/dd-touch.js +183 -0
  128. package/dist_save/dd-touch.js.map +1 -0
  129. package/dist_save/es5/dd-base-impl.d.ts +20 -0
  130. package/dist_save/es5/dd-base-impl.js +41 -0
  131. package/dist_save/es5/dd-base-impl.js.map +1 -0
  132. package/dist_save/es5/dd-draggable.d.ts +28 -0
  133. package/dist_save/es5/dd-draggable.js +366 -0
  134. package/dist_save/es5/dd-draggable.js.map +1 -0
  135. package/dist_save/es5/dd-droppable.d.ts +26 -0
  136. package/dist_save/es5/dd-droppable.js +180 -0
  137. package/dist_save/es5/dd-droppable.js.map +1 -0
  138. package/dist_save/es5/dd-element.d.ts +27 -0
  139. package/dist_save/es5/dd-element.js +96 -0
  140. package/dist_save/es5/dd-element.js.map +1 -0
  141. package/dist_save/es5/dd-gridstack.d.ts +34 -0
  142. package/dist_save/es5/dd-gridstack.js +145 -0
  143. package/dist_save/es5/dd-gridstack.js.map +1 -0
  144. package/dist_save/es5/dd-manager.d.ts +22 -0
  145. package/dist_save/es5/dd-manager.js +17 -0
  146. package/dist_save/es5/dd-manager.js.map +1 -0
  147. package/dist_save/es5/dd-resizable-handle.d.ts +14 -0
  148. package/dist_save/es5/dd-resizable-handle.js +107 -0
  149. package/dist_save/es5/dd-resizable-handle.js.map +1 -0
  150. package/dist_save/es5/dd-resizable.d.ts +28 -0
  151. package/dist_save/es5/dd-resizable.js +316 -0
  152. package/dist_save/es5/dd-resizable.js.map +1 -0
  153. package/dist_save/es5/dd-touch.d.ts +33 -0
  154. package/dist_save/es5/dd-touch.js +186 -0
  155. package/dist_save/es5/dd-touch.js.map +1 -0
  156. package/dist_save/es5/gridstack-all.js +3 -0
  157. package/dist_save/es5/gridstack-all.js.LICENSE.txt +7 -0
  158. package/dist_save/es5/gridstack-all.js.map +1 -0
  159. package/dist_save/es5/gridstack-engine.d.ts +102 -0
  160. package/dist_save/es5/gridstack-engine.js +997 -0
  161. package/dist_save/es5/gridstack-engine.js.map +1 -0
  162. package/dist_save/es5/gridstack-poly.js +356 -0
  163. package/dist_save/es5/gridstack.d.ts +376 -0
  164. package/dist_save/es5/gridstack.js +2238 -0
  165. package/dist_save/es5/gridstack.js.map +1 -0
  166. package/dist_save/es5/types.d.ts +284 -0
  167. package/dist_save/es5/types.js +36 -0
  168. package/dist_save/es5/types.js.map +1 -0
  169. package/dist_save/es5/utils.d.ts +95 -0
  170. package/dist_save/es5/utils.js +590 -0
  171. package/dist_save/es5/utils.js.map +1 -0
  172. package/dist_save/gridstack-all.js +3 -0
  173. package/dist_save/gridstack-all.js.LICENSE.txt +7 -0
  174. package/dist_save/gridstack-all.js.map +1 -0
  175. package/dist_save/gridstack-engine.d.ts +102 -0
  176. package/dist_save/gridstack-engine.js +956 -0
  177. package/dist_save/gridstack-engine.js.map +1 -0
  178. package/dist_save/gridstack-extra.css +433 -0
  179. package/dist_save/gridstack-extra.min.css +1 -0
  180. package/dist_save/gridstack.css +226 -0
  181. package/dist_save/gridstack.d.ts +376 -0
  182. package/dist_save/gridstack.js +2162 -0
  183. package/dist_save/gridstack.js.map +1 -0
  184. package/dist_save/gridstack.min.css +1 -0
  185. package/dist_save/src/gridstack-extra.scss +27 -0
  186. package/dist_save/src/gridstack.scss +131 -0
  187. package/dist_save/types.d.ts +284 -0
  188. package/dist_save/types.js +36 -0
  189. package/dist_save/types.js.map +1 -0
  190. package/dist_save/utils.d.ts +95 -0
  191. package/dist_save/utils.js +548 -0
  192. package/dist_save/utils.js.map +1 -0
  193. package/doc/CHANGES.md +20 -0
  194. package/doc/README.md +21 -14
  195. package/package.json +25 -24
  196. /package/{dist → dist_save}/angular/README.md +0 -0
package/dist/es5/types.js CHANGED
@@ -1,36 +1,48 @@
1
- "use strict";
2
- /**
3
- * types.ts 7.3.0
4
- * Copyright (c) 2021 Alain Dumesny - see GridStack root license
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.dragInDefaultOptions = exports.gridDefaults = void 0;
8
- // default values for grid options - used during init and when saving out
9
- exports.gridDefaults = {
10
- alwaysShowResizeHandle: 'mobile',
11
- animate: true,
12
- auto: true,
13
- cellHeight: 'auto',
14
- cellHeightThrottle: 100,
15
- cellHeightUnit: 'px',
16
- column: 12,
17
- draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },
18
- handle: '.grid-stack-item-content',
19
- itemClass: 'grid-stack-item',
20
- margin: 10,
21
- marginUnit: 'px',
22
- maxRow: 0,
23
- minRow: 0,
24
- oneColumnSize: 768,
25
- placeholderClass: 'grid-stack-placeholder',
26
- placeholderText: '',
27
- removableOptions: { accept: '.grid-stack-item' },
28
- resizable: { handles: 'se' },
29
- rtl: 'auto',
30
- };
31
- /** default dragIn options */
32
- exports.dragInDefaultOptions = {
33
- handle: '.grid-stack-item-content',
34
- appendTo: 'body',
35
- };
1
+ "use strict";
2
+ /**
3
+ * types.ts 8.0.1
4
+ * Copyright (c) 2021 Alain Dumesny - see GridStack root license
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.dragInDefaultOptions = exports.gridDefaults = void 0;
8
+ // default values for grid options - used during init and when saving out
9
+ exports.gridDefaults = {
10
+ alwaysShowResizeHandle: 'mobile',
11
+ animate: true,
12
+ auto: true,
13
+ cellHeight: 'auto',
14
+ cellHeightThrottle: 100,
15
+ cellHeightUnit: 'px',
16
+ column: 12,
17
+ draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },
18
+ handle: '.grid-stack-item-content',
19
+ itemClass: 'grid-stack-item',
20
+ margin: 10,
21
+ marginUnit: 'px',
22
+ maxRow: 0,
23
+ minRow: 0,
24
+ oneColumnSize: 768,
25
+ placeholderClass: 'grid-stack-placeholder',
26
+ placeholderText: '',
27
+ removableOptions: { accept: '.grid-stack-item' },
28
+ resizable: { handles: 'se' },
29
+ rtl: 'auto',
30
+ // **** same as not being set ****
31
+ // disableDrag: false,
32
+ // disableOneColumnMode: false,
33
+ // disableResize: false,
34
+ // float: false,
35
+ // handleClass: null,
36
+ // oneColumnModeDomSort: false,
37
+ // removable: false,
38
+ // staticGrid: false,
39
+ // styleInHead: false,
40
+ };
41
+ /** default dragIn options */
42
+ exports.dragInDefaultOptions = {
43
+ handle: '.grid-stack-item-content',
44
+ appendTo: 'body',
45
+ // revert: 'invalid',
46
+ // scroll: false,
47
+ };
36
48
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,yEAAyE;AAC5D,QAAA,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;CAYZ,CAAC;AAEF,6BAA6B;AAChB,QAAA,oBAAoB,GAAgB;IAC/C,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,MAAM;CAGjB,CAAC","sourcesContent":["/**\r\n * types.ts 7.3.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/**\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 /**\r\n * callback method use when new items|grids needs to be created or deleted, instead of the default\r\n * item: <div class=\"grid-stack-item\"><div class=\"grid-stack-item-content\">w.content</div></div>\r\n * grid: <div class=\"grid-stack\">grid content...</div>\r\n * add = true: the returned DOM element will then be converted to a GridItemHTMLElement using makeWidget()|GridStack:init().\r\n * add = false: the item will be removed from DOM (if not already done)\r\n * grid = true|false for grid vs grid-items\r\n */\r\n addRemoveCB?: AddRemoveFcn;\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 /** @internal Use `GridStack.setupDragIn()` instead (global, not per grid). old way to allow external items to be draggable. (default: undefined) */\r\n dragIn?: string;\r\n\r\n /** @internal Use `GridStack.setupDragIn()` instead (global, not per grid). old way to allow external items to be draggable. (default: undefined) */\r\n dragInOptions?: DDDragInOpt;\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 */\r\n subGrid?: 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 */\r\n subGrid?: GridStackOptions | GridStack;\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 Grid instance */\r\n grid?: 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;AAC5D,QAAA,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;AAChB,QAAA,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,93 +1,95 @@
1
- /**
2
- * utils.ts 7.3.0
3
- * Copyright (c) 2021 Alain Dumesny - see GridStack root license
4
- */
5
- import { GridStackElement, GridStackNode, GridStackOptions, numberOrString, GridStackPosition, GridStackWidget } from './types';
6
- export interface HeightData {
7
- h: number;
8
- unit: string;
9
- }
10
- /** checks for obsolete method names */
11
- export declare function obsolete(self: any, f: any, oldName: string, newName: string, rev: string): (...args: any[]) => any;
12
- /** checks for obsolete grid options (can be used for any fields, but msg is about options) */
13
- export declare function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void;
14
- /** checks for obsolete grid options which are gone */
15
- export declare function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void;
16
- /** checks for obsolete Jquery element attributes */
17
- export declare function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void;
18
- /**
19
- * Utility methods
20
- */
21
- export declare class Utils {
22
- /** convert a potential selector into actual list of html elements */
23
- static getElements(els: GridStackElement): HTMLElement[];
24
- /** convert a potential selector into actual single element */
25
- static getElement(els: GridStackElement): HTMLElement;
26
- /** returns true if a and b overlap */
27
- static isIntercepted(a: GridStackPosition, b: GridStackPosition): boolean;
28
- /** returns true if a and b touch edges or corners */
29
- static isTouching(a: GridStackPosition, b: GridStackPosition): boolean;
30
- /** returns the area a and b overlap */
31
- static areaIntercept(a: GridStackPosition, b: GridStackPosition): number;
32
- /** returns the area */
33
- static area(a: GridStackPosition): number;
34
- /**
35
- * Sorts array of nodes
36
- * @param nodes array to sort
37
- * @param dir 1 for asc, -1 for desc (optional)
38
- * @param width width of the grid. If undefined the width will be calculated automatically (optional).
39
- **/
40
- static sort(nodes: GridStackNode[], dir?: -1 | 1, column?: number): GridStackNode[];
41
- /**
42
- * creates a style sheet with style id under given parent
43
- * @param id will set the 'gs-style-id' attribute to that id
44
- * @param parent to insert the stylesheet as first child,
45
- * if none supplied it will be appended to the document head instead.
46
- */
47
- static createStylesheet(id: string, parent?: HTMLElement, options?: {
48
- nonce?: string;
49
- }): CSSStyleSheet;
50
- /** removed the given stylesheet id */
51
- static removeStylesheet(id: string): void;
52
- /** inserts a CSS rule */
53
- static addCSSRule(sheet: CSSStyleSheet, selector: string, rules: string): void;
54
- static toBool(v: unknown): boolean;
55
- static toNumber(value: null | string): number;
56
- static parseHeight(val: numberOrString): HeightData;
57
- /** copies unset fields in target to use the given default sources values */
58
- static defaults(target: any, ...sources: any[]): {};
59
- /** given 2 objects return true if they have the same values. Checks for Object {} having same fields and values (just 1 level down) */
60
- static same(a: unknown, b: unknown): boolean;
61
- /** copies over b size & position (GridStackPosition), and optionally min/max as well */
62
- static copyPos(a: GridStackWidget, b: GridStackWidget, doMinMax?: boolean): GridStackWidget;
63
- /** true if a and b has same size & position */
64
- static samePos(a: GridStackPosition, b: GridStackPosition): boolean;
65
- /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */
66
- static removeInternalAndSame(a: unknown, b: unknown): void;
67
- /** removes internal fields '_' and default values for saving */
68
- static removeInternalForSave(n: GridStackNode, removeEl?: boolean): void;
69
- /** return the closest parent (or itself) matching the given class */
70
- static closestUpByClass(el: HTMLElement, name: string): HTMLElement;
71
- /** delay calling the given function for given delay, preventing new calls from happening while waiting */
72
- static throttle(func: () => void, delay: number): () => void;
73
- static removePositioningStyles(el: HTMLElement): void;
74
- /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
75
- static clone<T>(obj: T): T;
76
- /**
77
- * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.
78
- * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.
79
- */
80
- static cloneDeep<T>(obj: T): T;
81
- /** deep clone the given HTML node, removing teh unique id field */
82
- static cloneNode(el: HTMLElement): HTMLElement;
83
- static appendTo(el: HTMLElement, parent: string | HTMLElement | Node): void;
84
- static addElStyles(el: HTMLElement, styles: {
85
- [prop: string]: string | string[];
86
- }): void;
87
- static initEvent<T>(e: DragEvent | MouseEvent, info: {
88
- type: string;
89
- target?: EventTarget;
90
- }): T;
91
- /** copies the MouseEvent properties and sends it as another event to the given target */
92
- static simulateMouseEvent(e: MouseEvent, simulatedType: string, target?: EventTarget): void;
93
- }
1
+ /**
2
+ * utils.ts 8.0.1
3
+ * Copyright (c) 2021 Alain Dumesny - see GridStack root license
4
+ */
5
+ import { GridStackElement, GridStackNode, GridStackOptions, numberOrString, GridStackPosition, GridStackWidget } from './types';
6
+ export interface HeightData {
7
+ h: number;
8
+ unit: string;
9
+ }
10
+ /** checks for obsolete method names */
11
+ export declare function obsolete(self: any, f: any, oldName: string, newName: string, rev: string): (...args: any[]) => any;
12
+ /** checks for obsolete grid options (can be used for any fields, but msg is about options) */
13
+ export declare function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void;
14
+ /** checks for obsolete grid options which are gone */
15
+ export declare function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void;
16
+ /** checks for obsolete Jquery element attributes */
17
+ export declare function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void;
18
+ /**
19
+ * Utility methods
20
+ */
21
+ export declare class Utils {
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[];
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;
26
+ /** returns true if a and b overlap */
27
+ static isIntercepted(a: GridStackPosition, b: GridStackPosition): boolean;
28
+ /** returns true if a and b touch edges or corners */
29
+ static isTouching(a: GridStackPosition, b: GridStackPosition): boolean;
30
+ /** returns the area a and b overlap */
31
+ static areaIntercept(a: GridStackPosition, b: GridStackPosition): number;
32
+ /** returns the area */
33
+ static area(a: GridStackPosition): number;
34
+ /**
35
+ * Sorts array of nodes
36
+ * @param nodes array to sort
37
+ * @param dir 1 for asc, -1 for desc (optional)
38
+ * @param width width of the grid. If undefined the width will be calculated automatically (optional).
39
+ **/
40
+ static sort(nodes: GridStackNode[], dir?: -1 | 1, column?: number): GridStackNode[];
41
+ /**
42
+ * creates a style sheet with style id under given parent
43
+ * @param id will set the 'gs-style-id' attribute to that id
44
+ * @param parent to insert the stylesheet as first child,
45
+ * if none supplied it will be appended to the document head instead.
46
+ */
47
+ static createStylesheet(id: string, parent?: HTMLElement, options?: {
48
+ nonce?: string;
49
+ }): CSSStyleSheet;
50
+ /** removed the given stylesheet id */
51
+ static removeStylesheet(id: string): void;
52
+ /** inserts a CSS rule */
53
+ static addCSSRule(sheet: CSSStyleSheet, selector: string, rules: string): void;
54
+ static toBool(v: unknown): boolean;
55
+ static toNumber(value: null | string): number;
56
+ static parseHeight(val: numberOrString): HeightData;
57
+ /** copies unset fields in target to use the given default sources values */
58
+ static defaults(target: any, ...sources: any[]): {};
59
+ /** given 2 objects return true if they have the same values. Checks for Object {} having same fields and values (just 1 level down) */
60
+ static same(a: unknown, b: unknown): boolean;
61
+ /** copies over b size & position (GridStackPosition), and optionally min/max as well */
62
+ static copyPos(a: GridStackWidget, b: GridStackWidget, doMinMax?: boolean): GridStackWidget;
63
+ /** true if a and b has same size & position */
64
+ static samePos(a: GridStackPosition, b: GridStackPosition): boolean;
65
+ /** given a node, makes sure it's min/max are valid */
66
+ static sanitizeMinMax(node: GridStackNode): void;
67
+ /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */
68
+ static removeInternalAndSame(a: unknown, b: unknown): void;
69
+ /** removes internal fields '_' and default values for saving */
70
+ static removeInternalForSave(n: GridStackNode, removeEl?: boolean): void;
71
+ /** return the closest parent (or itself) matching the given class */
72
+ static closestUpByClass(el: HTMLElement, name: string): HTMLElement;
73
+ /** delay calling the given function for given delay, preventing new calls from happening while waiting */
74
+ static throttle(func: () => void, delay: number): () => void;
75
+ static removePositioningStyles(el: HTMLElement): void;
76
+ /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */
77
+ static clone<T>(obj: T): T;
78
+ /**
79
+ * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.
80
+ * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.
81
+ */
82
+ static cloneDeep<T>(obj: T): T;
83
+ /** deep clone the given HTML node, removing teh unique id field */
84
+ static cloneNode(el: HTMLElement): HTMLElement;
85
+ static appendTo(el: HTMLElement, parent: string | HTMLElement): void;
86
+ static addElStyles(el: HTMLElement, styles: {
87
+ [prop: string]: string | string[];
88
+ }): void;
89
+ static initEvent<T>(e: DragEvent | MouseEvent, info: {
90
+ type: string;
91
+ target?: EventTarget;
92
+ }): T;
93
+ /** copies the MouseEvent properties and sends it as another event to the given target */
94
+ static simulateMouseEvent(e: MouseEvent, simulatedType: string, target?: EventTarget): void;
95
+ }