gridstack 8.0.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +14 -11
  2. package/dist/dd-base-impl.d.ts +1 -1
  3. package/dist/dd-base-impl.js +1 -1
  4. package/dist/dd-base-impl.js.map +1 -1
  5. package/dist/dd-draggable.d.ts +3 -2
  6. package/dist/dd-draggable.js +10 -9
  7. package/dist/dd-draggable.js.map +1 -1
  8. package/dist/dd-droppable.d.ts +1 -1
  9. package/dist/dd-droppable.js +1 -1
  10. package/dist/dd-droppable.js.map +1 -1
  11. package/dist/dd-element.d.ts +1 -1
  12. package/dist/dd-element.js +1 -1
  13. package/dist/dd-element.js.map +1 -1
  14. package/dist/dd-gridstack.d.ts +1 -1
  15. package/dist/dd-gridstack.js +1 -1
  16. package/dist/dd-gridstack.js.map +1 -1
  17. package/dist/dd-manager.d.ts +1 -1
  18. package/dist/dd-manager.js +1 -1
  19. package/dist/dd-manager.js.map +1 -1
  20. package/dist/dd-resizable-handle.d.ts +1 -1
  21. package/dist/dd-resizable-handle.js +1 -1
  22. package/dist/dd-resizable-handle.js.map +1 -1
  23. package/dist/dd-resizable.d.ts +1 -1
  24. package/dist/dd-resizable.js +1 -1
  25. package/dist/dd-resizable.js.map +1 -1
  26. package/dist/dd-touch.d.ts +1 -1
  27. package/dist/dd-touch.js +1 -1
  28. package/dist/dd-touch.js.map +1 -1
  29. package/dist/es5/dd-base-impl.d.ts +1 -1
  30. package/dist/es5/dd-base-impl.js +1 -1
  31. package/dist/es5/dd-base-impl.js.map +1 -1
  32. package/dist/es5/dd-draggable.d.ts +3 -2
  33. package/dist/es5/dd-draggable.js +10 -9
  34. package/dist/es5/dd-draggable.js.map +1 -1
  35. package/dist/es5/dd-droppable.d.ts +1 -1
  36. package/dist/es5/dd-droppable.js +1 -1
  37. package/dist/es5/dd-droppable.js.map +1 -1
  38. package/dist/es5/dd-element.d.ts +1 -1
  39. package/dist/es5/dd-element.js +1 -1
  40. package/dist/es5/dd-element.js.map +1 -1
  41. package/dist/es5/dd-gridstack.d.ts +1 -1
  42. package/dist/es5/dd-gridstack.js +1 -1
  43. package/dist/es5/dd-gridstack.js.map +1 -1
  44. package/dist/es5/dd-manager.d.ts +1 -1
  45. package/dist/es5/dd-manager.js +1 -1
  46. package/dist/es5/dd-manager.js.map +1 -1
  47. package/dist/es5/dd-resizable-handle.d.ts +1 -1
  48. package/dist/es5/dd-resizable-handle.js +1 -1
  49. package/dist/es5/dd-resizable-handle.js.map +1 -1
  50. package/dist/es5/dd-resizable.d.ts +1 -1
  51. package/dist/es5/dd-resizable.js +1 -1
  52. package/dist/es5/dd-resizable.js.map +1 -1
  53. package/dist/es5/dd-touch.d.ts +1 -1
  54. package/dist/es5/dd-touch.js +1 -1
  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 +1 -1
  60. package/dist/es5/gridstack-engine.js +1 -1
  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 +6 -3
  64. package/dist/es5/gridstack.js +18 -25
  65. package/dist/es5/gridstack.js.map +1 -1
  66. package/dist/es5/types.d.ts +5 -3
  67. package/dist/es5/types.js +1 -1
  68. package/dist/es5/types.js.map +1 -1
  69. package/dist/es5/utils.d.ts +6 -6
  70. package/dist/es5/utils.js +31 -20
  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 +1 -1
  76. package/dist/gridstack-engine.js +1 -1
  77. package/dist/gridstack-engine.js.map +1 -1
  78. package/dist/gridstack-extra.css +180 -240
  79. package/dist/gridstack-extra.min.css +1 -1
  80. package/dist/gridstack.css +99 -106
  81. package/dist/gridstack.d.ts +6 -3
  82. package/dist/gridstack.js +16 -25
  83. package/dist/gridstack.js.map +1 -1
  84. package/dist/gridstack.min.css +1 -1
  85. package/dist/ng/gridstack-item.component.d.ts +1 -1
  86. package/dist/ng/gridstack-item.component.js +1 -1
  87. package/dist/ng/gridstack.component.d.ts +1 -1
  88. package/dist/ng/gridstack.component.js +1 -1
  89. package/dist/src/gridstack-extra.scss +9 -11
  90. package/dist/src/gridstack.scss +108 -89
  91. package/dist/types.d.ts +5 -3
  92. package/dist/types.js +1 -1
  93. package/dist/types.js.map +1 -1
  94. package/dist/utils.d.ts +6 -6
  95. package/dist/utils.js +29 -20
  96. package/dist/utils.js.map +1 -1
  97. package/doc/CHANGES.md +15 -0
  98. package/doc/README.md +8 -14
  99. package/package.json +1 -1
  100. package/dist_save/angular/README.md +0 -94
  101. package/dist_save/angular/gridstack-item.component.ts +0 -72
  102. package/dist_save/angular/gridstack.component.ts +0 -199
  103. package/dist_save/dd-base-impl.d.ts +0 -20
  104. package/dist_save/dd-base-impl.js +0 -36
  105. package/dist_save/dd-base-impl.js.map +0 -1
  106. package/dist_save/dd-draggable.d.ts +0 -28
  107. package/dist_save/dd-draggable.js +0 -343
  108. package/dist_save/dd-draggable.js.map +0 -1
  109. package/dist_save/dd-droppable.d.ts +0 -26
  110. package/dist_save/dd-droppable.js +0 -149
  111. package/dist_save/dd-droppable.js.map +0 -1
  112. package/dist_save/dd-element.d.ts +0 -27
  113. package/dist_save/dd-element.js +0 -95
  114. package/dist_save/dd-element.js.map +0 -1
  115. package/dist_save/dd-gridstack.d.ts +0 -34
  116. package/dist_save/dd-gridstack.js +0 -125
  117. package/dist_save/dd-gridstack.js.map +0 -1
  118. package/dist_save/dd-manager.d.ts +0 -22
  119. package/dist_save/dd-manager.js +0 -14
  120. package/dist_save/dd-manager.js.map +0 -1
  121. package/dist_save/dd-resizable-handle.d.ts +0 -14
  122. package/dist_save/dd-resizable-handle.js +0 -106
  123. package/dist_save/dd-resizable-handle.js.map +0 -1
  124. package/dist_save/dd-resizable.d.ts +0 -28
  125. package/dist_save/dd-resizable.js +0 -294
  126. package/dist_save/dd-resizable.js.map +0 -1
  127. package/dist_save/dd-touch.d.ts +0 -33
  128. package/dist_save/dd-touch.js +0 -183
  129. package/dist_save/dd-touch.js.map +0 -1
  130. package/dist_save/es5/dd-base-impl.d.ts +0 -20
  131. package/dist_save/es5/dd-base-impl.js +0 -41
  132. package/dist_save/es5/dd-base-impl.js.map +0 -1
  133. package/dist_save/es5/dd-draggable.d.ts +0 -28
  134. package/dist_save/es5/dd-draggable.js +0 -366
  135. package/dist_save/es5/dd-draggable.js.map +0 -1
  136. package/dist_save/es5/dd-droppable.d.ts +0 -26
  137. package/dist_save/es5/dd-droppable.js +0 -180
  138. package/dist_save/es5/dd-droppable.js.map +0 -1
  139. package/dist_save/es5/dd-element.d.ts +0 -27
  140. package/dist_save/es5/dd-element.js +0 -96
  141. package/dist_save/es5/dd-element.js.map +0 -1
  142. package/dist_save/es5/dd-gridstack.d.ts +0 -34
  143. package/dist_save/es5/dd-gridstack.js +0 -145
  144. package/dist_save/es5/dd-gridstack.js.map +0 -1
  145. package/dist_save/es5/dd-manager.d.ts +0 -22
  146. package/dist_save/es5/dd-manager.js +0 -17
  147. package/dist_save/es5/dd-manager.js.map +0 -1
  148. package/dist_save/es5/dd-resizable-handle.d.ts +0 -14
  149. package/dist_save/es5/dd-resizable-handle.js +0 -107
  150. package/dist_save/es5/dd-resizable-handle.js.map +0 -1
  151. package/dist_save/es5/dd-resizable.d.ts +0 -28
  152. package/dist_save/es5/dd-resizable.js +0 -316
  153. package/dist_save/es5/dd-resizable.js.map +0 -1
  154. package/dist_save/es5/dd-touch.d.ts +0 -33
  155. package/dist_save/es5/dd-touch.js +0 -186
  156. package/dist_save/es5/dd-touch.js.map +0 -1
  157. package/dist_save/es5/gridstack-all.js +0 -3
  158. package/dist_save/es5/gridstack-all.js.LICENSE.txt +0 -7
  159. package/dist_save/es5/gridstack-all.js.map +0 -1
  160. package/dist_save/es5/gridstack-engine.d.ts +0 -102
  161. package/dist_save/es5/gridstack-engine.js +0 -997
  162. package/dist_save/es5/gridstack-engine.js.map +0 -1
  163. package/dist_save/es5/gridstack-poly.js +0 -356
  164. package/dist_save/es5/gridstack.d.ts +0 -376
  165. package/dist_save/es5/gridstack.js +0 -2238
  166. package/dist_save/es5/gridstack.js.map +0 -1
  167. package/dist_save/es5/types.d.ts +0 -284
  168. package/dist_save/es5/types.js +0 -36
  169. package/dist_save/es5/types.js.map +0 -1
  170. package/dist_save/es5/utils.d.ts +0 -95
  171. package/dist_save/es5/utils.js +0 -590
  172. package/dist_save/es5/utils.js.map +0 -1
  173. package/dist_save/gridstack-all.js +0 -3
  174. package/dist_save/gridstack-all.js.LICENSE.txt +0 -7
  175. package/dist_save/gridstack-all.js.map +0 -1
  176. package/dist_save/gridstack-engine.d.ts +0 -102
  177. package/dist_save/gridstack-engine.js +0 -956
  178. package/dist_save/gridstack-engine.js.map +0 -1
  179. package/dist_save/gridstack-extra.css +0 -433
  180. package/dist_save/gridstack-extra.min.css +0 -1
  181. package/dist_save/gridstack.css +0 -226
  182. package/dist_save/gridstack.d.ts +0 -376
  183. package/dist_save/gridstack.js +0 -2162
  184. package/dist_save/gridstack.js.map +0 -1
  185. package/dist_save/gridstack.min.css +0 -1
  186. package/dist_save/src/gridstack-extra.scss +0 -27
  187. package/dist_save/src/gridstack.scss +0 -131
  188. package/dist_save/types.d.ts +0 -284
  189. package/dist_save/types.js +0 -36
  190. package/dist_save/types.js.map +0 -1
  191. package/dist_save/utils.d.ts +0 -95
  192. package/dist_save/utils.js +0 -548
  193. package/dist_save/utils.js.map +0 -1
@@ -1,14 +0,0 @@
1
- /**
2
- * dd-resizable-handle.ts 7.3.0-dev
3
- * Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
4
- */
5
- export interface DDResizableHandleOpt {
6
- start?: (event: any) => void;
7
- move?: (event: any) => void;
8
- stop?: (event: any) => void;
9
- }
10
- export declare class DDResizableHandle {
11
- constructor(host: HTMLElement, direction: string, option: DDResizableHandleOpt);
12
- /** call this when resize handle needs to be removed and cleaned up */
13
- destroy(): DDResizableHandle;
14
- }
@@ -1,106 +0,0 @@
1
- "use strict";
2
- /**
3
- * dd-resizable-handle.ts 7.3.0-dev
4
- * Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DDResizableHandle = void 0;
8
- const dd_touch_1 = require("./dd-touch");
9
- class DDResizableHandle {
10
- constructor(host, direction, option) {
11
- /** @internal true after we've moved enough pixels to start a resize */
12
- this.moving = false;
13
- this.host = host;
14
- this.dir = direction;
15
- this.option = option;
16
- // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)
17
- this._mouseDown = this._mouseDown.bind(this);
18
- this._mouseMove = this._mouseMove.bind(this);
19
- this._mouseUp = this._mouseUp.bind(this);
20
- this._init();
21
- }
22
- /** @internal */
23
- _init() {
24
- const el = document.createElement('div');
25
- el.classList.add('ui-resizable-handle');
26
- el.classList.add(`${DDResizableHandle.prefix}${this.dir}`);
27
- el.style.zIndex = '100';
28
- el.style.userSelect = 'none';
29
- this.el = el;
30
- this.host.appendChild(this.el);
31
- this.el.addEventListener('mousedown', this._mouseDown);
32
- if (dd_touch_1.isTouch) {
33
- this.el.addEventListener('touchstart', dd_touch_1.touchstart);
34
- this.el.addEventListener('pointerdown', dd_touch_1.pointerdown);
35
- // this.el.style.touchAction = 'none'; // not needed unlike pointerdown doc comment
36
- }
37
- return this;
38
- }
39
- /** call this when resize handle needs to be removed and cleaned up */
40
- destroy() {
41
- if (this.moving)
42
- this._mouseUp(this.mouseDownEvent);
43
- this.el.removeEventListener('mousedown', this._mouseDown);
44
- if (dd_touch_1.isTouch) {
45
- this.el.removeEventListener('touchstart', dd_touch_1.touchstart);
46
- this.el.removeEventListener('pointerdown', dd_touch_1.pointerdown);
47
- }
48
- this.host.removeChild(this.el);
49
- delete this.el;
50
- delete this.host;
51
- return this;
52
- }
53
- /** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */
54
- _mouseDown(e) {
55
- this.mouseDownEvent = e;
56
- document.addEventListener('mousemove', this._mouseMove, true); // capture, not bubble
57
- document.addEventListener('mouseup', this._mouseUp, true);
58
- if (dd_touch_1.isTouch) {
59
- this.el.addEventListener('touchmove', dd_touch_1.touchmove);
60
- this.el.addEventListener('touchend', dd_touch_1.touchend);
61
- }
62
- e.stopPropagation();
63
- e.preventDefault();
64
- }
65
- /** @internal */
66
- _mouseMove(e) {
67
- let s = this.mouseDownEvent;
68
- if (this.moving) {
69
- this._triggerEvent('move', e);
70
- }
71
- else if (Math.abs(e.x - s.x) + Math.abs(e.y - s.y) > 2) {
72
- // don't start unless we've moved at least 3 pixels
73
- this.moving = true;
74
- this._triggerEvent('start', this.mouseDownEvent);
75
- this._triggerEvent('move', e);
76
- }
77
- e.stopPropagation();
78
- e.preventDefault();
79
- }
80
- /** @internal */
81
- _mouseUp(e) {
82
- if (this.moving) {
83
- this._triggerEvent('stop', e);
84
- }
85
- document.removeEventListener('mousemove', this._mouseMove, true);
86
- document.removeEventListener('mouseup', this._mouseUp, true);
87
- if (dd_touch_1.isTouch) {
88
- this.el.removeEventListener('touchmove', dd_touch_1.touchmove);
89
- this.el.removeEventListener('touchend', dd_touch_1.touchend);
90
- }
91
- delete this.moving;
92
- delete this.mouseDownEvent;
93
- e.stopPropagation();
94
- e.preventDefault();
95
- }
96
- /** @internal */
97
- _triggerEvent(name, event) {
98
- if (this.option[name])
99
- this.option[name](event);
100
- return this;
101
- }
102
- }
103
- exports.DDResizableHandle = DDResizableHandle;
104
- /** @internal */
105
- DDResizableHandle.prefix = 'ui-resizable-';
106
- //# sourceMappingURL=dd-resizable-handle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dd-resizable-handle.js","sourceRoot":"","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,OAAO,IAAI,CAAC,MAAM,CAAC;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC;QAC3B,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,CAAC,CAAC,cAAc,EAAE,CAAC;IACrB,CAAC;IAED,gBAAgB;IACN,aAAa,CAAC,IAAY,EAAE,KAAiB;QACrD,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;;AA7GH,8CA8GC;AAjGC,gBAAgB;AACC,wBAAM,GAAG,eAAe,CAAC","sourcesContent":["/**\n * dd-resizable-handle.ts 7.3.0-dev\n * Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license\n */\n\nimport { isTouch, pointerdown, touchend, touchmove, touchstart } from './dd-touch';\n\nexport interface DDResizableHandleOpt {\n start?: (event) => void;\n move?: (event) => void;\n stop?: (event) => void;\n}\n\nexport class DDResizableHandle {\n /** @internal */\n protected el: HTMLElement;\n /** @internal */\n protected host: HTMLElement;\n /** @internal */\n protected option: DDResizableHandleOpt;\n /** @internal */\n protected dir: string;\n /** @internal true after we've moved enough pixels to start a resize */\n protected moving = false;\n /** @internal */\n protected mouseDownEvent: MouseEvent;\n /** @internal */\n protected static prefix = 'ui-resizable-';\n\n constructor(host: HTMLElement, direction: string, option: DDResizableHandleOpt) {\n this.host = host;\n this.dir = direction;\n this.option = option;\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n this._mouseDown = this._mouseDown.bind(this);\n this._mouseMove = this._mouseMove.bind(this);\n this._mouseUp = this._mouseUp.bind(this);\n\n this._init();\n }\n\n /** @internal */\n protected _init(): DDResizableHandle {\n const el = document.createElement('div');\n el.classList.add('ui-resizable-handle');\n el.classList.add(`${DDResizableHandle.prefix}${this.dir}`);\n el.style.zIndex = '100';\n el.style.userSelect = 'none';\n this.el = el;\n this.host.appendChild(this.el);\n this.el.addEventListener('mousedown', this._mouseDown);\n if (isTouch) {\n this.el.addEventListener('touchstart', touchstart);\n this.el.addEventListener('pointerdown', pointerdown);\n // this.el.style.touchAction = 'none'; // not needed unlike pointerdown doc comment\n }\n return this;\n }\n\n /** call this when resize handle needs to be removed and cleaned up */\n public destroy(): DDResizableHandle {\n if (this.moving) this._mouseUp(this.mouseDownEvent);\n this.el.removeEventListener('mousedown', this._mouseDown);\n if (isTouch) {\n this.el.removeEventListener('touchstart', touchstart);\n this.el.removeEventListener('pointerdown', pointerdown);\n }\n this.host.removeChild(this.el);\n delete this.el;\n delete this.host;\n return this;\n }\n\n /** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */\n protected _mouseDown(e: MouseEvent): void {\n this.mouseDownEvent = e;\n document.addEventListener('mousemove', this._mouseMove, true); // capture, not bubble\n document.addEventListener('mouseup', this._mouseUp, true);\n if (isTouch) {\n this.el.addEventListener('touchmove', touchmove);\n this.el.addEventListener('touchend', touchend);\n }\n e.stopPropagation();\n e.preventDefault();\n }\n\n /** @internal */\n protected _mouseMove(e: MouseEvent): void {\n let s = this.mouseDownEvent;\n if (this.moving) {\n this._triggerEvent('move', e);\n } else if (Math.abs(e.x - s.x) + Math.abs(e.y - s.y) > 2) {\n // don't start unless we've moved at least 3 pixels\n this.moving = true;\n this._triggerEvent('start', this.mouseDownEvent);\n this._triggerEvent('move', e);\n }\n e.stopPropagation();\n e.preventDefault();\n }\n\n /** @internal */\n protected _mouseUp(e: MouseEvent): void {\n if (this.moving) {\n this._triggerEvent('stop', e);\n }\n document.removeEventListener('mousemove', this._mouseMove, true);\n document.removeEventListener('mouseup', this._mouseUp, true);\n if (isTouch) {\n this.el.removeEventListener('touchmove', touchmove);\n this.el.removeEventListener('touchend', touchend);\n }\n delete this.moving;\n delete this.mouseDownEvent;\n e.stopPropagation();\n e.preventDefault();\n }\n\n /** @internal */\n protected _triggerEvent(name: string, event: MouseEvent): DDResizableHandle {\n if (this.option[name]) this.option[name](event);\n return this;\n }\n}\n"]}
@@ -1,28 +0,0 @@
1
- /**
2
- * dd-resizable.ts 7.3.0-dev
3
- * Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
4
- */
5
- import { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';
6
- import { DDUIData } from './types';
7
- export interface DDResizableOpt {
8
- autoHide?: boolean;
9
- handles?: string;
10
- maxHeight?: number;
11
- maxWidth?: number;
12
- minHeight?: number;
13
- minWidth?: number;
14
- start?: (event: Event, ui: DDUIData) => void;
15
- stop?: (event: Event) => void;
16
- resize?: (event: Event, ui: DDUIData) => void;
17
- }
18
- export declare class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt<DDResizableOpt> {
19
- el: HTMLElement;
20
- option: DDResizableOpt;
21
- constructor(el: HTMLElement, opts?: DDResizableOpt);
22
- on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void;
23
- off(event: 'resizestart' | 'resize' | 'resizestop'): void;
24
- enable(): void;
25
- disable(): void;
26
- destroy(): void;
27
- updateOption(opts: DDResizableOpt): DDResizable;
28
- }
@@ -1,294 +0,0 @@
1
- "use strict";
2
- /**
3
- * dd-resizable.ts 7.3.0-dev
4
- * Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DDResizable = void 0;
8
- const dd_resizable_handle_1 = require("./dd-resizable-handle");
9
- const dd_base_impl_1 = require("./dd-base-impl");
10
- const utils_1 = require("./utils");
11
- const dd_manager_1 = require("./dd-manager");
12
- class DDResizable extends dd_base_impl_1.DDBaseImplement {
13
- constructor(el, opts = {}) {
14
- super();
15
- /** @internal */
16
- this._ui = () => {
17
- const containmentEl = this.el.parentElement;
18
- const containmentRect = containmentEl.getBoundingClientRect();
19
- const newRect = {
20
- width: this.originalRect.width,
21
- height: this.originalRect.height + this.scrolled,
22
- left: this.originalRect.left,
23
- top: this.originalRect.top - this.scrolled
24
- };
25
- const rect = this.temporalRect || newRect;
26
- return {
27
- position: {
28
- left: rect.left - containmentRect.left,
29
- top: rect.top - containmentRect.top
30
- },
31
- size: {
32
- width: rect.width,
33
- height: rect.height
34
- }
35
- /* Gridstack ONLY needs position set above... keep around in case.
36
- element: [this.el], // The object representing the element to be resized
37
- helper: [], // TODO: not support yet - The object representing the helper that's being resized
38
- originalElement: [this.el],// we don't wrap here, so simplify as this.el //The object representing the original element before it is wrapped
39
- originalPosition: { // The position represented as { left, top } before the resizable is resized
40
- left: this.originalRect.left - containmentRect.left,
41
- top: this.originalRect.top - containmentRect.top
42
- },
43
- originalSize: { // The size represented as { width, height } before the resizable is resized
44
- width: this.originalRect.width,
45
- height: this.originalRect.height
46
- }
47
- */
48
- };
49
- };
50
- this.el = el;
51
- this.option = opts;
52
- // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)
53
- this._mouseOver = this._mouseOver.bind(this);
54
- this._mouseOut = this._mouseOut.bind(this);
55
- this.enable();
56
- this._setupAutoHide(this.option.autoHide);
57
- this._setupHandlers();
58
- }
59
- on(event, callback) {
60
- super.on(event, callback);
61
- }
62
- off(event) {
63
- super.off(event);
64
- }
65
- enable() {
66
- super.enable();
67
- this.el.classList.remove('ui-resizable-disabled');
68
- this._setupAutoHide(this.option.autoHide);
69
- }
70
- disable() {
71
- super.disable();
72
- this.el.classList.add('ui-resizable-disabled');
73
- this._setupAutoHide(false);
74
- }
75
- destroy() {
76
- this._removeHandlers();
77
- this._setupAutoHide(false);
78
- delete this.el;
79
- super.destroy();
80
- }
81
- updateOption(opts) {
82
- let updateHandles = (opts.handles && opts.handles !== this.option.handles);
83
- let updateAutoHide = (opts.autoHide && opts.autoHide !== this.option.autoHide);
84
- Object.keys(opts).forEach(key => this.option[key] = opts[key]);
85
- if (updateHandles) {
86
- this._removeHandlers();
87
- this._setupHandlers();
88
- }
89
- if (updateAutoHide) {
90
- this._setupAutoHide(this.option.autoHide);
91
- }
92
- return this;
93
- }
94
- /** @internal turns auto hide on/off */
95
- _setupAutoHide(auto) {
96
- if (auto) {
97
- this.el.classList.add('ui-resizable-autohide');
98
- // use mouseover and not mouseenter to get better performance and track for nested cases
99
- this.el.addEventListener('mouseover', this._mouseOver);
100
- this.el.addEventListener('mouseout', this._mouseOut);
101
- }
102
- else {
103
- this.el.classList.remove('ui-resizable-autohide');
104
- this.el.removeEventListener('mouseover', this._mouseOver);
105
- this.el.removeEventListener('mouseout', this._mouseOut);
106
- if (dd_manager_1.DDManager.overResizeElement === this) {
107
- delete dd_manager_1.DDManager.overResizeElement;
108
- }
109
- }
110
- return this;
111
- }
112
- /** @internal */
113
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
114
- _mouseOver(e) {
115
- // console.log(`${count++} pre-enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
116
- // already over a child, ignore. Ideally we just call e.stopPropagation() but see https://github.com/gridstack/gridstack.js/issues/2018
117
- if (dd_manager_1.DDManager.overResizeElement || dd_manager_1.DDManager.dragElement)
118
- return;
119
- dd_manager_1.DDManager.overResizeElement = this;
120
- // console.log(`${count++} enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
121
- this.el.classList.remove('ui-resizable-autohide');
122
- }
123
- /** @internal */
124
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
125
- _mouseOut(e) {
126
- // console.log(`${count++} pre-leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
127
- if (dd_manager_1.DDManager.overResizeElement !== this)
128
- return;
129
- delete dd_manager_1.DDManager.overResizeElement;
130
- // console.log(`${count++} leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
131
- this.el.classList.add('ui-resizable-autohide');
132
- }
133
- /** @internal */
134
- _setupHandlers() {
135
- let handlerDirection = this.option.handles || 'e,s,se';
136
- if (handlerDirection === 'all') {
137
- handlerDirection = 'n,e,s,w,se,sw,ne,nw';
138
- }
139
- this.handlers = handlerDirection.split(',')
140
- .map(dir => dir.trim())
141
- .map(dir => new dd_resizable_handle_1.DDResizableHandle(this.el, dir, {
142
- start: (event) => {
143
- this._resizeStart(event);
144
- },
145
- stop: (event) => {
146
- this._resizeStop(event);
147
- },
148
- move: (event) => {
149
- this._resizing(event, dir);
150
- }
151
- }));
152
- return this;
153
- }
154
- /** @internal */
155
- _resizeStart(event) {
156
- this.originalRect = this.el.getBoundingClientRect();
157
- this.scrollEl = utils_1.Utils.getScrollElement(this.el);
158
- this.scrollY = this.scrollEl.scrollTop;
159
- this.scrolled = 0;
160
- this.startEvent = event;
161
- this._setupHelper();
162
- this._applyChange();
163
- const ev = utils_1.Utils.initEvent(event, { type: 'resizestart', target: this.el });
164
- if (this.option.start) {
165
- this.option.start(ev, this._ui());
166
- }
167
- this.el.classList.add('ui-resizable-resizing');
168
- this.triggerEvent('resizestart', ev);
169
- return this;
170
- }
171
- /** @internal */
172
- _resizing(event, dir) {
173
- this.scrolled = this.scrollEl.scrollTop - this.scrollY;
174
- this.temporalRect = this._getChange(event, dir);
175
- this._applyChange();
176
- const ev = utils_1.Utils.initEvent(event, { type: 'resize', target: this.el });
177
- if (this.option.resize) {
178
- this.option.resize(ev, this._ui());
179
- }
180
- this.triggerEvent('resize', ev);
181
- return this;
182
- }
183
- /** @internal */
184
- _resizeStop(event) {
185
- const ev = utils_1.Utils.initEvent(event, { type: 'resizestop', target: this.el });
186
- if (this.option.stop) {
187
- this.option.stop(ev); // Note: ui() not used by gridstack so don't pass
188
- }
189
- this.el.classList.remove('ui-resizable-resizing');
190
- this.triggerEvent('resizestop', ev);
191
- this._cleanHelper();
192
- delete this.startEvent;
193
- delete this.originalRect;
194
- delete this.temporalRect;
195
- delete this.scrollY;
196
- delete this.scrolled;
197
- return this;
198
- }
199
- /** @internal */
200
- _setupHelper() {
201
- this.elOriginStyleVal = DDResizable._originStyleProp.map(prop => this.el.style[prop]);
202
- this.parentOriginStylePosition = this.el.parentElement.style.position;
203
- if (window.getComputedStyle(this.el.parentElement).position.match(/static/)) {
204
- this.el.parentElement.style.position = 'relative';
205
- }
206
- this.el.style.position = 'absolute';
207
- this.el.style.opacity = '0.8';
208
- return this;
209
- }
210
- /** @internal */
211
- _cleanHelper() {
212
- DDResizable._originStyleProp.forEach((prop, i) => {
213
- this.el.style[prop] = this.elOriginStyleVal[i] || null;
214
- });
215
- this.el.parentElement.style.position = this.parentOriginStylePosition || null;
216
- return this;
217
- }
218
- /** @internal */
219
- _getChange(event, dir) {
220
- const oEvent = this.startEvent;
221
- const newRect = {
222
- width: this.originalRect.width,
223
- height: this.originalRect.height + this.scrolled,
224
- left: this.originalRect.left,
225
- top: this.originalRect.top - this.scrolled
226
- };
227
- const offsetX = event.clientX - oEvent.clientX;
228
- const offsetY = event.clientY - oEvent.clientY;
229
- if (dir.indexOf('e') > -1) {
230
- newRect.width += offsetX;
231
- }
232
- else if (dir.indexOf('w') > -1) {
233
- newRect.width -= offsetX;
234
- newRect.left += offsetX;
235
- }
236
- if (dir.indexOf('s') > -1) {
237
- newRect.height += offsetY;
238
- }
239
- else if (dir.indexOf('n') > -1) {
240
- newRect.height -= offsetY;
241
- newRect.top += offsetY;
242
- }
243
- const constrain = this._constrainSize(newRect.width, newRect.height);
244
- if (Math.round(newRect.width) !== Math.round(constrain.width)) { // round to ignore slight round-off errors
245
- if (dir.indexOf('w') > -1) {
246
- newRect.left += newRect.width - constrain.width;
247
- }
248
- newRect.width = constrain.width;
249
- }
250
- if (Math.round(newRect.height) !== Math.round(constrain.height)) {
251
- if (dir.indexOf('n') > -1) {
252
- newRect.top += newRect.height - constrain.height;
253
- }
254
- newRect.height = constrain.height;
255
- }
256
- return newRect;
257
- }
258
- /** @internal constrain the size to the set min/max values */
259
- _constrainSize(oWidth, oHeight) {
260
- const maxWidth = this.option.maxWidth || Number.MAX_SAFE_INTEGER;
261
- const minWidth = this.option.minWidth || oWidth;
262
- const maxHeight = this.option.maxHeight || Number.MAX_SAFE_INTEGER;
263
- const minHeight = this.option.minHeight || oHeight;
264
- const width = Math.min(maxWidth, Math.max(minWidth, oWidth));
265
- const height = Math.min(maxHeight, Math.max(minHeight, oHeight));
266
- return { width, height };
267
- }
268
- /** @internal */
269
- _applyChange() {
270
- let containmentRect = { left: 0, top: 0, width: 0, height: 0 };
271
- if (this.el.style.position === 'absolute') {
272
- const containmentEl = this.el.parentElement;
273
- const { left, top } = containmentEl.getBoundingClientRect();
274
- containmentRect = { left, top, width: 0, height: 0 };
275
- }
276
- if (!this.temporalRect)
277
- return this;
278
- Object.keys(this.temporalRect).forEach(key => {
279
- const value = this.temporalRect[key];
280
- this.el.style[key] = value - containmentRect[key] + 'px';
281
- });
282
- return this;
283
- }
284
- /** @internal */
285
- _removeHandlers() {
286
- this.handlers.forEach(handle => handle.destroy());
287
- delete this.handlers;
288
- return this;
289
- }
290
- }
291
- exports.DDResizable = DDResizable;
292
- /** @internal */
293
- DDResizable._originStyleProp = ['width', 'height', 'position', 'left', 'top', 'opacity', 'zIndex'];
294
- //# sourceMappingURL=dd-resizable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dd-resizable.js","sourceRoot":"","sources":["../src/dd-resizable.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA0D;AAC1D,iDAAuE;AACvE,mCAAgC;AAEhC,6CAAyC;AAiBzC,MAAa,WAAY,SAAQ,8BAAe;IA2B9C,YAAY,EAAe,EAAE,OAAuB,EAAE;QACpD,KAAK,EAAE,CAAC;QAiQV,gBAAgB;QACN,QAAG,GAAG,GAAa,EAAE;YAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;YAC5C,MAAM,eAAe,GAAG,aAAa,CAAC,qBAAqB,EAAE,CAAC;YAC9D,MAAM,OAAO,GAAG;gBACd,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;gBAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ;gBAChD,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;gBAC5B,GAAG,EAAE,IAAI,C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AAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB;IACN,eAAe;QACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AA3RH,kCAgUC;AAxSC,gBAAgB;AACC,4BAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["/**\n * dd-resizable.ts 7.3.0-dev\n * Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license\n */\n\nimport { DDResizableHandle } from './dd-resizable-handle';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { Utils } from './utils';\nimport { DDUIData, Rect, Size } from './types';\nimport { DDManager } from './dd-manager';\n\n// import { GridItemHTMLElement } from './types'; let count = 0; // TEST\n\n// TODO: merge with DDDragOpt\nexport interface DDResizableOpt {\n autoHide?: boolean;\n handles?: string;\n maxHeight?: number;\n maxWidth?: number;\n minHeight?: number;\n minWidth?: number;\n start?: (event: Event, ui: DDUIData) => void;\n stop?: (event: Event) => void;\n resize?: (event: Event, ui: DDUIData) => void;\n}\n\nexport class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt<DDResizableOpt> {\n\n // have to be public else complains for HTMLElementExtendOpt ?\n public el: HTMLElement;\n public option: DDResizableOpt;\n\n /** @internal */\n protected handlers: DDResizableHandle[];\n /** @internal */\n protected originalRect: Rect;\n /** @internal */\n protected temporalRect: Rect;\n /** @internal */\n protected scrollY: number;\n /** @internal */\n protected scrolled: number;\n /** @internal */\n protected scrollEl: HTMLElement;\n /** @internal */\n protected startEvent: MouseEvent;\n /** @internal value saved in the same order as _originStyleProp[] */\n protected elOriginStyleVal: string[];\n /** @internal */\n protected parentOriginStylePosition: string;\n /** @internal */\n protected static _originStyleProp = ['width', 'height', 'position', 'left', 'top', 'opacity', 'zIndex'];\n\n constructor(el: HTMLElement, opts: DDResizableOpt = {}) {\n super();\n this.el = el;\n this.option = opts;\n // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n this._mouseOver = this._mouseOver.bind(this);\n this._mouseOut = this._mouseOut.bind(this);\n this.enable();\n this._setupAutoHide(this.option.autoHide);\n this._setupHandlers();\n }\n\n public on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void {\n super.on(event, callback);\n }\n\n public off(event: 'resizestart' | 'resize' | 'resizestop'): void {\n super.off(event);\n }\n\n public enable(): void {\n super.enable();\n this.el.classList.remove('ui-resizable-disabled');\n this._setupAutoHide(this.option.autoHide);\n }\n\n public disable(): void {\n super.disable();\n this.el.classList.add('ui-resizable-disabled');\n this._setupAutoHide(false);\n }\n\n public destroy(): void {\n this._removeHandlers();\n this._setupAutoHide(false);\n delete this.el;\n super.destroy();\n }\n\n public updateOption(opts: DDResizableOpt): DDResizable {\n let updateHandles = (opts.handles && opts.handles !== this.option.handles);\n let updateAutoHide = (opts.autoHide && opts.autoHide !== this.option.autoHide);\n Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n if (updateHandles) {\n this._removeHandlers();\n this._setupHandlers();\n }\n if (updateAutoHide) {\n this._setupAutoHide(this.option.autoHide);\n }\n return this;\n }\n\n /** @internal turns auto hide on/off */\n protected _setupAutoHide(auto: boolean): DDResizable {\n if (auto) {\n this.el.classList.add('ui-resizable-autohide');\n // use mouseover and not mouseenter to get better performance and track for nested cases\n this.el.addEventListener('mouseover', this._mouseOver);\n this.el.addEventListener('mouseout', this._mouseOut);\n } else {\n this.el.classList.remove('ui-resizable-autohide');\n this.el.removeEventListener('mouseover', this._mouseOver);\n this.el.removeEventListener('mouseout', this._mouseOut);\n if (DDManager.overResizeElement === this) {\n delete DDManager.overResizeElement;\n }\n }\n return this;\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected _mouseOver(e: Event): void {\n // console.log(`${count++} pre-enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n // already over a child, ignore. Ideally we just call e.stopPropagation() but see https://github.com/gridstack/gridstack.js/issues/2018\n if (DDManager.overResizeElement || DDManager.dragElement) return;\n DDManager.overResizeElement = this;\n // console.log(`${count++} enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n this.el.classList.remove('ui-resizable-autohide');\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected _mouseOut(e: Event): void {\n // console.log(`${count++} pre-leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n if (DDManager.overResizeElement !== this) return;\n delete DDManager.overResizeElement;\n // console.log(`${count++} leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n this.el.classList.add('ui-resizable-autohide');\n }\n\n /** @internal */\n protected _setupHandlers(): DDResizable {\n let handlerDirection = this.option.handles || 'e,s,se';\n if (handlerDirection === 'all') {\n handlerDirection = 'n,e,s,w,se,sw,ne,nw';\n }\n this.handlers = handlerDirection.split(',')\n .map(dir => dir.trim())\n .map(dir => new DDResizableHandle(this.el, dir, {\n start: (event: MouseEvent) => {\n this._resizeStart(event);\n },\n stop: (event: MouseEvent) => {\n this._resizeStop(event);\n },\n move: (event: MouseEvent) => {\n this._resizing(event, dir);\n }\n }));\n return this;\n }\n\n /** @internal */\n protected _resizeStart(event: MouseEvent): DDResizable {\n this.originalRect = this.el.getBoundingClientRect();\n this.scrollEl = Utils.getScrollElement(this.el);\n this.scrollY = this.scrollEl.scrollTop;\n this.scrolled = 0;\n this.startEvent = event;\n this._setupHelper();\n this._applyChange();\n const ev = Utils.initEvent<MouseEvent>(event, { type: 'resizestart', target: this.el });\n if (this.option.start) {\n this.option.start(ev, this._ui());\n }\n this.el.classList.add('ui-resizable-resizing');\n this.triggerEvent('resizestart', ev);\n return this;\n }\n\n /** @internal */\n protected _resizing(event: MouseEvent, dir: string): DDResizable {\n this.scrolled = this.scrollEl.scrollTop - this.scrollY;\n this.temporalRect = this._getChange(event, dir);\n this._applyChange();\n const ev = Utils.initEvent<MouseEvent>(event, { type: 'resize', target: this.el });\n if (this.option.resize) {\n this.option.resize(ev, this._ui());\n }\n this.triggerEvent('resize', ev);\n return this;\n }\n\n /** @internal */\n protected _resizeStop(event: MouseEvent): DDResizable {\n const ev = Utils.initEvent<MouseEvent>(event, { type: 'resizestop', target: this.el });\n if (this.option.stop) {\n this.option.stop(ev); // Note: ui() not used by gridstack so don't pass\n }\n this.el.classList.remove('ui-resizable-resizing');\n this.triggerEvent('resizestop', ev);\n this._cleanHelper();\n delete this.startEvent;\n delete this.originalRect;\n delete this.temporalRect;\n delete this.scrollY;\n delete this.scrolled;\n return this;\n }\n\n /** @internal */\n protected _setupHelper(): DDResizable {\n this.elOriginStyleVal = DDResizable._originStyleProp.map(prop => this.el.style[prop]);\n this.parentOriginStylePosition = this.el.parentElement.style.position;\n if (window.getComputedStyle(this.el.parentElement).position.match(/static/)) {\n this.el.parentElement.style.position = 'relative';\n }\n this.el.style.position = 'absolute';\n this.el.style.opacity = '0.8';\n return this;\n }\n\n /** @internal */\n protected _cleanHelper(): DDResizable {\n DDResizable._originStyleProp.forEach((prop, i) => {\n this.el.style[prop] = this.elOriginStyleVal[i] || null;\n });\n this.el.parentElement.style.position = this.parentOriginStylePosition || null;\n return this;\n }\n\n /** @internal */\n protected _getChange(event: MouseEvent, dir: string): Rect {\n const oEvent = this.startEvent;\n const newRect = { // Note: originalRect is a complex object, not a simple Rect, so copy out.\n width: this.originalRect.width,\n height: this.originalRect.height + this.scrolled,\n left: this.originalRect.left,\n top: this.originalRect.top - this.scrolled\n };\n\n const offsetX = event.clientX - oEvent.clientX;\n const offsetY = event.clientY - oEvent.clientY;\n\n if (dir.indexOf('e') > -1) {\n newRect.width += offsetX;\n } else if (dir.indexOf('w') > -1) {\n newRect.width -= offsetX;\n newRect.left += offsetX;\n }\n if (dir.indexOf('s') > -1) {\n newRect.height += offsetY;\n } else if (dir.indexOf('n') > -1) {\n newRect.height -= offsetY;\n newRect.top += offsetY\n }\n const constrain = this._constrainSize(newRect.width, newRect.height);\n if (Math.round(newRect.width) !== Math.round(constrain.width)) { // round to ignore slight round-off errors\n if (dir.indexOf('w') > -1) {\n newRect.left += newRect.width - constrain.width;\n }\n newRect.width = constrain.width;\n }\n if (Math.round(newRect.height) !== Math.round(constrain.height)) {\n if (dir.indexOf('n') > -1) {\n newRect.top += newRect.height - constrain.height;\n }\n newRect.height = constrain.height;\n }\n return newRect;\n }\n\n /** @internal constrain the size to the set min/max values */\n protected _constrainSize(oWidth: number, oHeight: number): Size {\n const maxWidth = this.option.maxWidth || Number.MAX_SAFE_INTEGER;\n const minWidth = this.option.minWidth || oWidth;\n const maxHeight = this.option.maxHeight || Number.MAX_SAFE_INTEGER;\n const minHeight = this.option.minHeight || oHeight;\n const width = Math.min(maxWidth, Math.max(minWidth, oWidth));\n const height = Math.min(maxHeight, Math.max(minHeight, oHeight));\n return { width, height };\n }\n\n /** @internal */\n protected _applyChange(): DDResizable {\n let containmentRect = { left: 0, top: 0, width: 0, height: 0 };\n if (this.el.style.position === 'absolute') {\n const containmentEl = this.el.parentElement;\n const { left, top } = containmentEl.getBoundingClientRect();\n containmentRect = { left, top, width: 0, height: 0 };\n }\n if (!this.temporalRect) return this;\n Object.keys(this.temporalRect).forEach(key => {\n const value = this.temporalRect[key];\n this.el.style[key] = value - containmentRect[key] + 'px';\n });\n return this;\n }\n\n /** @internal */\n protected _removeHandlers(): DDResizable {\n this.handlers.forEach(handle => handle.destroy());\n delete this.handlers;\n return this;\n }\n\n /** @internal */\n protected _ui = (): DDUIData => {\n const containmentEl = this.el.parentElement;\n const containmentRect = containmentEl.getBoundingClientRect();\n const newRect = { // Note: originalRect is a complex object, not a simple Rect, so copy out.\n width: this.originalRect.width,\n height: this.originalRect.height + this.scrolled,\n left: this.originalRect.left,\n top: this.originalRect.top - this.scrolled\n };\n const rect = this.temporalRect || newRect;\n return {\n position: {\n left: rect.left - containmentRect.left,\n top: rect.top - containmentRect.top\n },\n size: {\n width: rect.width,\n height: rect.height\n }\n /* Gridstack ONLY needs position set above... keep around in case.\n element: [this.el], // The object representing the element to be resized\n helper: [], // TODO: not support yet - The object representing the helper that's being resized\n originalElement: [this.el],// we don't wrap here, so simplify as this.el //The object representing the original element before it is wrapped\n originalPosition: { // The position represented as { left, top } before the resizable is resized\n left: this.originalRect.left - containmentRect.left,\n top: this.originalRect.top - containmentRect.top\n },\n originalSize: { // The size represented as { width, height } before the resizable is resized\n width: this.originalRect.width,\n height: this.originalRect.height\n }\n */\n };\n }\n}\n"]}
@@ -1,33 +0,0 @@
1
- /**
2
- * touch.ts 7.3.0-dev
3
- * Copyright (c) 2021 Alain Dumesny - see GridStack root license
4
- */
5
- /**
6
- * Detect touch support - Windows Surface devices and other touch devices
7
- * should we use this instead ? (what we had for always showing resize handles)
8
- * /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
9
- */
10
- export declare const isTouch: boolean;
11
- /**
12
- * Handle the touchstart events
13
- * @param {Object} e The widget element's touchstart event
14
- */
15
- export declare function touchstart(e: TouchEvent): void;
16
- /**
17
- * Handle the touchmove events
18
- * @param {Object} e The document's touchmove event
19
- */
20
- export declare function touchmove(e: TouchEvent): void;
21
- /**
22
- * Handle the touchend events
23
- * @param {Object} e The document's touchend event
24
- */
25
- export declare function touchend(e: TouchEvent): void;
26
- /**
27
- * Note we don't get touchenter/touchleave (which are deprecated)
28
- * see https://stackoverflow.com/questions/27908339/js-touch-equivalent-for-mouseenter
29
- * so instead of PointerEvent to still get enter/leave and send the matching mouse event.
30
- */
31
- export declare function pointerdown(e: PointerEvent): void;
32
- export declare function pointerenter(e: PointerEvent): void;
33
- export declare function pointerleave(e: PointerEvent): void;