gridstack 12.0.0 → 12.1.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 (106) hide show
  1. package/README.md +5 -3
  2. package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
  3. package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
  4. package/dist/angular/esm2020/lib/gridstack.component.mjs +18 -4
  5. package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
  6. package/dist/angular/esm2020/lib/types.mjs +2 -2
  7. package/dist/angular/fesm2015/gridstack-angular.mjs +22 -6
  8. package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
  9. package/dist/angular/fesm2020/gridstack-angular.mjs +21 -7
  10. package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
  11. package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
  12. package/dist/angular/lib/gridstack.component.d.ts +1 -1
  13. package/dist/angular/lib/types.d.ts +1 -1
  14. package/dist/angular/src/base-widget.ts +1 -1
  15. package/dist/angular/src/gridstack-item.component.ts +1 -1
  16. package/dist/angular/src/gridstack.component.ts +15 -3
  17. package/dist/angular/src/gridstack.module.ts +1 -1
  18. package/dist/dd-base-impl.d.ts +1 -1
  19. package/dist/dd-base-impl.js +1 -1
  20. package/dist/dd-base-impl.js.map +1 -1
  21. package/dist/dd-draggable.d.ts +1 -1
  22. package/dist/dd-draggable.js +1 -1
  23. package/dist/dd-draggable.js.map +1 -1
  24. package/dist/dd-droppable.d.ts +1 -1
  25. package/dist/dd-droppable.js +1 -1
  26. package/dist/dd-droppable.js.map +1 -1
  27. package/dist/dd-element.d.ts +1 -1
  28. package/dist/dd-element.js +1 -1
  29. package/dist/dd-element.js.map +1 -1
  30. package/dist/dd-gridstack.d.ts +1 -1
  31. package/dist/dd-gridstack.js +1 -1
  32. package/dist/dd-gridstack.js.map +1 -1
  33. package/dist/dd-manager.d.ts +1 -1
  34. package/dist/dd-manager.js +1 -1
  35. package/dist/dd-manager.js.map +1 -1
  36. package/dist/dd-resizable-handle.d.ts +1 -1
  37. package/dist/dd-resizable-handle.js +1 -1
  38. package/dist/dd-resizable-handle.js.map +1 -1
  39. package/dist/dd-resizable.d.ts +1 -1
  40. package/dist/dd-resizable.js +1 -1
  41. package/dist/dd-resizable.js.map +1 -1
  42. package/dist/dd-touch.d.ts +1 -1
  43. package/dist/dd-touch.js +1 -1
  44. package/dist/dd-touch.js.map +1 -1
  45. package/dist/gridstack-all.js +1 -1
  46. package/dist/gridstack-all.js.LICENSE.txt +1 -1
  47. package/dist/gridstack-all.js.map +1 -1
  48. package/dist/gridstack-engine.d.ts +1 -1
  49. package/dist/gridstack-engine.js +1 -1
  50. package/dist/gridstack-engine.js.map +1 -1
  51. package/dist/gridstack.css +1 -1
  52. package/dist/gridstack.d.ts +3 -1
  53. package/dist/gridstack.js +58 -56
  54. package/dist/gridstack.js.map +1 -1
  55. package/dist/src/gridstack.scss +1 -1
  56. package/dist/types.d.ts +1 -1
  57. package/dist/types.js +1 -1
  58. package/dist/types.js.map +1 -1
  59. package/dist/utils.d.ts +1 -1
  60. package/dist/utils.js +1 -1
  61. package/dist/utils.js.map +1 -1
  62. package/doc/CHANGES.md +14 -0
  63. package/package.json +2 -4
  64. package/dist/es5/dd-base-impl.d.ts +0 -20
  65. package/dist/es5/dd-base-impl.js +0 -41
  66. package/dist/es5/dd-base-impl.js.map +0 -1
  67. package/dist/es5/dd-draggable.d.ts +0 -20
  68. package/dist/es5/dd-draggable.js +0 -408
  69. package/dist/es5/dd-draggable.js.map +0 -1
  70. package/dist/es5/dd-droppable.d.ts +0 -26
  71. package/dist/es5/dd-droppable.js +0 -185
  72. package/dist/es5/dd-droppable.js.map +0 -1
  73. package/dist/es5/dd-element.d.ts +0 -27
  74. package/dist/es5/dd-element.js +0 -96
  75. package/dist/es5/dd-element.js.map +0 -1
  76. package/dist/es5/dd-gridstack.d.ts +0 -34
  77. package/dist/es5/dd-gridstack.js +0 -154
  78. package/dist/es5/dd-gridstack.js.map +0 -1
  79. package/dist/es5/dd-manager.d.ts +0 -22
  80. package/dist/es5/dd-manager.js +0 -17
  81. package/dist/es5/dd-manager.js.map +0 -1
  82. package/dist/es5/dd-resizable-handle.d.ts +0 -18
  83. package/dist/es5/dd-resizable-handle.js +0 -117
  84. package/dist/es5/dd-resizable-handle.js.map +0 -1
  85. package/dist/es5/dd-resizable.d.ts +0 -30
  86. package/dist/es5/dd-resizable.js +0 -331
  87. package/dist/es5/dd-resizable.js.map +0 -1
  88. package/dist/es5/dd-touch.d.ts +0 -33
  89. package/dist/es5/dd-touch.js +0 -157
  90. package/dist/es5/dd-touch.js.map +0 -1
  91. package/dist/es5/gridstack-all.js +0 -3
  92. package/dist/es5/gridstack-all.js.LICENSE.txt +0 -7
  93. package/dist/es5/gridstack-all.js.map +0 -1
  94. package/dist/es5/gridstack-engine.d.ts +0 -107
  95. package/dist/es5/gridstack-engine.js +0 -1070
  96. package/dist/es5/gridstack-engine.js.map +0 -1
  97. package/dist/es5/gridstack-poly.js +0 -356
  98. package/dist/es5/gridstack.d.ts +0 -452
  99. package/dist/es5/gridstack.js +0 -2644
  100. package/dist/es5/gridstack.js.map +0 -1
  101. package/dist/es5/types.d.ts +0 -326
  102. package/dist/es5/types.js +0 -38
  103. package/dist/es5/types.js.map +0 -1
  104. package/dist/es5/utils.d.ts +0 -104
  105. package/dist/es5/utils.js +0 -633
  106. package/dist/es5/utils.js.map +0 -1
@@ -1,117 +0,0 @@
1
- "use strict";
2
- /**
3
- * dd-resizable-handle.ts 12.0.0
4
- * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DDResizableHandle = void 0;
8
- var dd_touch_1 = require("./dd-touch");
9
- var DDResizableHandle = exports.DDResizableHandle = /** @class */ (function () {
10
- function DDResizableHandle(host, dir, option) {
11
- this.host = host;
12
- this.dir = dir;
13
- this.option = option;
14
- /** @internal true after we've moved enough pixels to start a resize */
15
- this.moving = false;
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._keyEvent = this._keyEvent.bind(this);
21
- this._init();
22
- }
23
- /** @internal */
24
- DDResizableHandle.prototype._init = function () {
25
- var el = this.el = document.createElement('div');
26
- el.classList.add('ui-resizable-handle');
27
- el.classList.add("".concat(DDResizableHandle.prefix).concat(this.dir));
28
- el.style.zIndex = '100';
29
- el.style.userSelect = 'none';
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
- DDResizableHandle.prototype.destroy = function () {
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
- DDResizableHandle.prototype._mouseDown = function (e) {
55
- this.mouseDownEvent = e;
56
- document.addEventListener('mousemove', this._mouseMove, { capture: true, passive: 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
- DDResizableHandle.prototype._mouseMove = function (e) {
67
- var 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
- // now track keyboard events to cancel
77
- document.addEventListener('keydown', this._keyEvent);
78
- }
79
- e.stopPropagation();
80
- // e.preventDefault(); passive = true
81
- };
82
- /** @internal */
83
- DDResizableHandle.prototype._mouseUp = function (e) {
84
- if (this.moving) {
85
- this._triggerEvent('stop', e);
86
- document.removeEventListener('keydown', this._keyEvent);
87
- }
88
- document.removeEventListener('mousemove', this._mouseMove, true);
89
- document.removeEventListener('mouseup', this._mouseUp, true);
90
- if (dd_touch_1.isTouch) {
91
- this.el.removeEventListener('touchmove', dd_touch_1.touchmove);
92
- this.el.removeEventListener('touchend', dd_touch_1.touchend);
93
- }
94
- delete this.moving;
95
- delete this.mouseDownEvent;
96
- e.stopPropagation();
97
- e.preventDefault();
98
- };
99
- /** @internal call when keys are being pressed - use Esc to cancel */
100
- DDResizableHandle.prototype._keyEvent = function (e) {
101
- var _a, _b;
102
- if (e.key === 'Escape') {
103
- (_b = (_a = this.host.gridstackNode) === null || _a === void 0 ? void 0 : _a.grid) === null || _b === void 0 ? void 0 : _b.engine.restoreInitial();
104
- this._mouseUp(this.mouseDownEvent);
105
- }
106
- };
107
- /** @internal */
108
- DDResizableHandle.prototype._triggerEvent = function (name, event) {
109
- if (this.option[name])
110
- this.option[name](event);
111
- return this;
112
- };
113
- /** @internal */
114
- DDResizableHandle.prefix = 'ui-resizable-';
115
- return DDResizableHandle;
116
- }());
117
- //# sourceMappingURL=dd-resizable-handle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dd-resizable-handle.js","sourceRoot":"","sources":["../../src/dd-resizable-handle.ts"],"names":[],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C,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC7D,IAAI,kBAAO,EAAE;YACX,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,WAAW,EAAE,oBAAS,CAAC,CAAC;YACpD,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,UAAU,EAAE,mBAAQ,CAAC,CAAC;SACnD;QACD,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,qEAAqE;IAC3D,qCAAS,GAAnB,UAAoB,CAAgB;;QAClC,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;YACtB,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,MAAM,CAAC,cAAc,EAAE,CAAC;YACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SACpC;IACH,CAAC;IAID,gBAAgB;IACN,yCAAa,GAAvB,UAAwB,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;IA1GD,gBAAgB;IACC,wBAAM,GAAG,eAAe,AAAlB,CAAmB;IA0G5C,wBAAC;CAAA,AAlHD,IAkHC","sourcesContent":["/**\n * dd-resizable-handle.ts 12.0.0\n * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license\n */\n\nimport { isTouch, pointerdown, touchend, touchmove, touchstart } from './dd-touch';\nimport { GridItemHTMLElement } from './gridstack';\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 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(protected host: GridItemHTMLElement, protected dir: string, protected option: DDResizableHandleOpt) {\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 this._keyEvent = this._keyEvent.bind(this);\n\n this._init();\n }\n\n /** @internal */\n protected _init(): DDResizableHandle {\n const el = this.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.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, { capture: true, passive: 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 const 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 // now track keyboard events to cancel\n document.addEventListener('keydown', this._keyEvent);\n }\n e.stopPropagation();\n // e.preventDefault(); passive = true\n }\n\n /** @internal */\n protected _mouseUp(e: MouseEvent): void {\n if (this.moving) {\n this._triggerEvent('stop', e);\n document.removeEventListener('keydown', this._keyEvent);\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 call when keys are being pressed - use Esc to cancel */\n protected _keyEvent(e: KeyboardEvent): void {\n if (e.key === 'Escape') {\n this.host.gridstackNode?.grid?.engine.restoreInitial();\n this._mouseUp(this.mouseDownEvent);\n }\n }\n\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,30 +0,0 @@
1
- /**
2
- * dd-resizable.ts 12.0.0
3
- * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
4
- */
5
- import { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';
6
- import { DDUIData, GridItemHTMLElement } from './types';
7
- export interface DDResizableOpt {
8
- autoHide?: boolean;
9
- handles?: string;
10
- maxHeight?: number;
11
- maxHeightMoveUp?: number;
12
- maxWidth?: number;
13
- maxWidthMoveLeft?: number;
14
- minHeight?: number;
15
- minWidth?: number;
16
- start?: (event: Event, ui: DDUIData) => void;
17
- stop?: (event: Event) => void;
18
- resize?: (event: Event, ui: DDUIData) => void;
19
- }
20
- export declare class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt<DDResizableOpt> {
21
- el: GridItemHTMLElement;
22
- option: DDResizableOpt;
23
- constructor(el: GridItemHTMLElement, option?: DDResizableOpt);
24
- on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void;
25
- off(event: 'resizestart' | 'resize' | 'resizestop'): void;
26
- enable(): void;
27
- disable(): void;
28
- destroy(): void;
29
- updateOption(opts: DDResizableOpt): DDResizable;
30
- }
@@ -1,331 +0,0 @@
1
- "use strict";
2
- /**
3
- * dd-resizable.ts 12.0.0
4
- * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
5
- */
6
- var __extends = (this && this.__extends) || (function () {
7
- var extendStatics = function (d, b) {
8
- extendStatics = Object.setPrototypeOf ||
9
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
11
- return extendStatics(d, b);
12
- };
13
- return function (d, b) {
14
- if (typeof b !== "function" && b !== null)
15
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
16
- extendStatics(d, b);
17
- function __() { this.constructor = d; }
18
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19
- };
20
- })();
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.DDResizable = void 0;
23
- var dd_resizable_handle_1 = require("./dd-resizable-handle");
24
- var dd_base_impl_1 = require("./dd-base-impl");
25
- var utils_1 = require("./utils");
26
- var dd_manager_1 = require("./dd-manager");
27
- var DDResizable = exports.DDResizable = /** @class */ (function (_super) {
28
- __extends(DDResizable, _super);
29
- // have to be public else complains for HTMLElementExtendOpt ?
30
- function DDResizable(el, option) {
31
- if (option === void 0) { option = {}; }
32
- var _this = _super.call(this) || this;
33
- _this.el = el;
34
- _this.option = option;
35
- /** @internal */
36
- _this.rectScale = { x: 1, y: 1 };
37
- /** @internal */
38
- _this._ui = function () {
39
- var containmentEl = _this.el.parentElement;
40
- var containmentRect = containmentEl.getBoundingClientRect();
41
- var newRect = {
42
- width: _this.originalRect.width,
43
- height: _this.originalRect.height + _this.scrolled,
44
- left: _this.originalRect.left,
45
- top: _this.originalRect.top - _this.scrolled
46
- };
47
- var rect = _this.temporalRect || newRect;
48
- return {
49
- position: {
50
- left: (rect.left - containmentRect.left) * _this.rectScale.x,
51
- top: (rect.top - containmentRect.top) * _this.rectScale.y
52
- },
53
- size: {
54
- width: rect.width * _this.rectScale.x,
55
- height: rect.height * _this.rectScale.y
56
- }
57
- /* Gridstack ONLY needs position set above... keep around in case.
58
- element: [this.el], // The object representing the element to be resized
59
- helper: [], // TODO: not support yet - The object representing the helper that's being resized
60
- originalElement: [this.el],// we don't wrap here, so simplify as this.el //The object representing the original element before it is wrapped
61
- originalPosition: { // The position represented as { left, top } before the resizable is resized
62
- left: this.originalRect.left - containmentRect.left,
63
- top: this.originalRect.top - containmentRect.top
64
- },
65
- originalSize: { // The size represented as { width, height } before the resizable is resized
66
- width: this.originalRect.width,
67
- height: this.originalRect.height
68
- }
69
- */
70
- };
71
- };
72
- // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)
73
- _this._mouseOver = _this._mouseOver.bind(_this);
74
- _this._mouseOut = _this._mouseOut.bind(_this);
75
- _this.enable();
76
- _this._setupAutoHide(_this.option.autoHide);
77
- _this._setupHandlers();
78
- return _this;
79
- }
80
- DDResizable.prototype.on = function (event, callback) {
81
- _super.prototype.on.call(this, event, callback);
82
- };
83
- DDResizable.prototype.off = function (event) {
84
- _super.prototype.off.call(this, event);
85
- };
86
- DDResizable.prototype.enable = function () {
87
- _super.prototype.enable.call(this);
88
- this.el.classList.remove('ui-resizable-disabled');
89
- this._setupAutoHide(this.option.autoHide);
90
- };
91
- DDResizable.prototype.disable = function () {
92
- _super.prototype.disable.call(this);
93
- this.el.classList.add('ui-resizable-disabled');
94
- this._setupAutoHide(false);
95
- };
96
- DDResizable.prototype.destroy = function () {
97
- this._removeHandlers();
98
- this._setupAutoHide(false);
99
- delete this.el;
100
- _super.prototype.destroy.call(this);
101
- };
102
- DDResizable.prototype.updateOption = function (opts) {
103
- var _this = this;
104
- var updateHandles = (opts.handles && opts.handles !== this.option.handles);
105
- var updateAutoHide = (opts.autoHide && opts.autoHide !== this.option.autoHide);
106
- Object.keys(opts).forEach(function (key) { return _this.option[key] = opts[key]; });
107
- if (updateHandles) {
108
- this._removeHandlers();
109
- this._setupHandlers();
110
- }
111
- if (updateAutoHide) {
112
- this._setupAutoHide(this.option.autoHide);
113
- }
114
- return this;
115
- };
116
- /** @internal turns auto hide on/off */
117
- DDResizable.prototype._setupAutoHide = function (auto) {
118
- if (auto) {
119
- this.el.classList.add('ui-resizable-autohide');
120
- // use mouseover and not mouseenter to get better performance and track for nested cases
121
- this.el.addEventListener('mouseover', this._mouseOver);
122
- this.el.addEventListener('mouseout', this._mouseOut);
123
- }
124
- else {
125
- this.el.classList.remove('ui-resizable-autohide');
126
- this.el.removeEventListener('mouseover', this._mouseOver);
127
- this.el.removeEventListener('mouseout', this._mouseOut);
128
- if (dd_manager_1.DDManager.overResizeElement === this) {
129
- delete dd_manager_1.DDManager.overResizeElement;
130
- }
131
- }
132
- return this;
133
- };
134
- /** @internal */
135
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
136
- DDResizable.prototype._mouseOver = function (e) {
137
- // console.log(`${count++} pre-enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
138
- // already over a child, ignore. Ideally we just call e.stopPropagation() but see https://github.com/gridstack/gridstack.js/issues/2018
139
- if (dd_manager_1.DDManager.overResizeElement || dd_manager_1.DDManager.dragElement)
140
- return;
141
- dd_manager_1.DDManager.overResizeElement = this;
142
- // console.log(`${count++} enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
143
- this.el.classList.remove('ui-resizable-autohide');
144
- };
145
- /** @internal */
146
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
147
- DDResizable.prototype._mouseOut = function (e) {
148
- // console.log(`${count++} pre-leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
149
- if (dd_manager_1.DDManager.overResizeElement !== this)
150
- return;
151
- delete dd_manager_1.DDManager.overResizeElement;
152
- // console.log(`${count++} leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)
153
- this.el.classList.add('ui-resizable-autohide');
154
- };
155
- /** @internal */
156
- DDResizable.prototype._setupHandlers = function () {
157
- var _this = this;
158
- this.handlers = this.option.handles.split(',')
159
- .map(function (dir) { return dir.trim(); })
160
- .map(function (dir) { return new dd_resizable_handle_1.DDResizableHandle(_this.el, dir, {
161
- start: function (event) {
162
- _this._resizeStart(event);
163
- },
164
- stop: function (event) {
165
- _this._resizeStop(event);
166
- },
167
- move: function (event) {
168
- _this._resizing(event, dir);
169
- }
170
- }); });
171
- return this;
172
- };
173
- /** @internal */
174
- DDResizable.prototype._resizeStart = function (event) {
175
- this.sizeToContent = utils_1.Utils.shouldSizeToContent(this.el.gridstackNode, true); // strick true only and not number
176
- this.originalRect = this.el.getBoundingClientRect();
177
- this.scrollEl = utils_1.Utils.getScrollElement(this.el);
178
- this.scrollY = this.scrollEl.scrollTop;
179
- this.scrolled = 0;
180
- this.startEvent = event;
181
- this._setupHelper();
182
- this._applyChange();
183
- var ev = utils_1.Utils.initEvent(event, { type: 'resizestart', target: this.el });
184
- if (this.option.start) {
185
- this.option.start(ev, this._ui());
186
- }
187
- this.el.classList.add('ui-resizable-resizing');
188
- this.triggerEvent('resizestart', ev);
189
- return this;
190
- };
191
- /** @internal */
192
- DDResizable.prototype._resizing = function (event, dir) {
193
- this.scrolled = this.scrollEl.scrollTop - this.scrollY;
194
- this.temporalRect = this._getChange(event, dir);
195
- this._applyChange();
196
- var ev = utils_1.Utils.initEvent(event, { type: 'resize', target: this.el });
197
- if (this.option.resize) {
198
- this.option.resize(ev, this._ui());
199
- }
200
- this.triggerEvent('resize', ev);
201
- return this;
202
- };
203
- /** @internal */
204
- DDResizable.prototype._resizeStop = function (event) {
205
- var ev = utils_1.Utils.initEvent(event, { type: 'resizestop', target: this.el });
206
- // Remove style attr now, so the stop handler can rebuild style attrs
207
- this._cleanHelper();
208
- if (this.option.stop) {
209
- this.option.stop(ev); // Note: ui() not used by gridstack so don't pass
210
- }
211
- this.el.classList.remove('ui-resizable-resizing');
212
- this.triggerEvent('resizestop', ev);
213
- delete this.startEvent;
214
- delete this.originalRect;
215
- delete this.temporalRect;
216
- delete this.scrollY;
217
- delete this.scrolled;
218
- return this;
219
- };
220
- /** @internal */
221
- DDResizable.prototype._setupHelper = function () {
222
- var _this = this;
223
- this.elOriginStyleVal = DDResizable._originStyleProp.map(function (prop) { return _this.el.style[prop]; });
224
- this.parentOriginStylePosition = this.el.parentElement.style.position;
225
- var parent = this.el.parentElement;
226
- var dragTransform = utils_1.Utils.getValuesFromTransformedElement(parent);
227
- this.rectScale = {
228
- x: dragTransform.xScale,
229
- y: dragTransform.yScale
230
- };
231
- if (getComputedStyle(this.el.parentElement).position.match(/static/)) {
232
- this.el.parentElement.style.position = 'relative';
233
- }
234
- this.el.style.position = 'absolute';
235
- this.el.style.opacity = '0.8';
236
- return this;
237
- };
238
- /** @internal */
239
- DDResizable.prototype._cleanHelper = function () {
240
- var _this = this;
241
- DDResizable._originStyleProp.forEach(function (prop, i) {
242
- _this.el.style[prop] = _this.elOriginStyleVal[i] || null;
243
- });
244
- this.el.parentElement.style.position = this.parentOriginStylePosition || null;
245
- return this;
246
- };
247
- /** @internal */
248
- DDResizable.prototype._getChange = function (event, dir) {
249
- var oEvent = this.startEvent;
250
- var newRect = {
251
- width: this.originalRect.width,
252
- height: this.originalRect.height + this.scrolled,
253
- left: this.originalRect.left,
254
- top: this.originalRect.top - this.scrolled
255
- };
256
- var offsetX = event.clientX - oEvent.clientX;
257
- var offsetY = this.sizeToContent ? 0 : event.clientY - oEvent.clientY; // prevent vert resize
258
- var moveLeft;
259
- var moveUp;
260
- if (dir.indexOf('e') > -1) {
261
- newRect.width += offsetX;
262
- }
263
- else if (dir.indexOf('w') > -1) {
264
- newRect.width -= offsetX;
265
- newRect.left += offsetX;
266
- moveLeft = true;
267
- }
268
- if (dir.indexOf('s') > -1) {
269
- newRect.height += offsetY;
270
- }
271
- else if (dir.indexOf('n') > -1) {
272
- newRect.height -= offsetY;
273
- newRect.top += offsetY;
274
- moveUp = true;
275
- }
276
- var constrain = this._constrainSize(newRect.width, newRect.height, moveLeft, moveUp);
277
- if (Math.round(newRect.width) !== Math.round(constrain.width)) { // round to ignore slight round-off errors
278
- if (dir.indexOf('w') > -1) {
279
- newRect.left += newRect.width - constrain.width;
280
- }
281
- newRect.width = constrain.width;
282
- }
283
- if (Math.round(newRect.height) !== Math.round(constrain.height)) {
284
- if (dir.indexOf('n') > -1) {
285
- newRect.top += newRect.height - constrain.height;
286
- }
287
- newRect.height = constrain.height;
288
- }
289
- return newRect;
290
- };
291
- /** @internal constrain the size to the set min/max values */
292
- DDResizable.prototype._constrainSize = function (oWidth, oHeight, moveLeft, moveUp) {
293
- var o = this.option;
294
- var maxWidth = (moveLeft ? o.maxWidthMoveLeft : o.maxWidth) || Number.MAX_SAFE_INTEGER;
295
- var minWidth = o.minWidth / this.rectScale.x || oWidth;
296
- var maxHeight = (moveUp ? o.maxHeightMoveUp : o.maxHeight) || Number.MAX_SAFE_INTEGER;
297
- var minHeight = o.minHeight / this.rectScale.y || oHeight;
298
- var width = Math.min(maxWidth, Math.max(minWidth, oWidth));
299
- var height = Math.min(maxHeight, Math.max(minHeight, oHeight));
300
- return { width: width, height: height };
301
- };
302
- /** @internal */
303
- DDResizable.prototype._applyChange = function () {
304
- var _a;
305
- var _this = this;
306
- var containmentRect = { left: 0, top: 0, width: 0, height: 0 };
307
- if (this.el.style.position === 'absolute') {
308
- var containmentEl = this.el.parentElement;
309
- var left = (_a = containmentEl.getBoundingClientRect(), _a.left), top_1 = _a.top;
310
- containmentRect = { left: left, top: top_1, width: 0, height: 0 };
311
- }
312
- if (!this.temporalRect)
313
- return this;
314
- Object.keys(this.temporalRect).forEach(function (key) {
315
- var value = _this.temporalRect[key];
316
- var scaleReciprocal = key === 'width' || key === 'left' ? _this.rectScale.x : key === 'height' || key === 'top' ? _this.rectScale.y : 1;
317
- _this.el.style[key] = (value - containmentRect[key]) * scaleReciprocal + 'px';
318
- });
319
- return this;
320
- };
321
- /** @internal */
322
- DDResizable.prototype._removeHandlers = function () {
323
- this.handlers.forEach(function (handle) { return handle.destroy(); });
324
- delete this.handlers;
325
- return this;
326
- };
327
- /** @internal */
328
- DDResizable._originStyleProp = ['width', 'height', 'position', 'left', 'top', 'opacity', 'zIndex'];
329
- return DDResizable;
330
- }(dd_base_impl_1.DDBaseImplement));
331
- //# 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,6DAA0D;AAC1D,+CAAuE;AACvE,iCAAgC;AAEhC,2CAAyC;AAwBzC;IAAiC,+BAAe;IA0B9C,8DAA8D;IAC9D,qBAAmB,EAAuB,EAAS,MAA2B;QAA3B,uBAAA,EAAA,WAA2B;QAA9E,YACE,iBAAO,SAOR;QARkB,QAAE,GAAF,EAAE,CAAqB;QAAS,YAAM,GAAN,MAAM,CAAqB;QAtB9E,gBAAgB;QACN,eAAS,GAAwB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAiS1D,gBAAgB;QACN,SAAG,GAAG;YACd,IAAM,aAAa,GAAG,KAAI,CAAC,EAAE,CAAC,aAAa,CAAC;YAC5C,IAAM,eAAe,GAAG,aAAa,CAAC,qBAAqB,EAAE,CAAC;YAC9D,IAAM,OAAO,GAAG;gBACd,KAAK,EAAE,KAAI,CAAC,YAAY,CAAC,KAAK;gBAC9B,MAAM,EAAE,KAAI,CAAC,YAAY,CAAC,MAAM,GAAG,KAAI,CAAC,QAAQ;gBAChD,IAAI,EAAE,KAAI,CAAC,YAAY,CAAC,IAAI;gBAC5B,GAAG,EAAE,KAA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AC,CAAC,GAAG,eAAe,GAAG,IAAI,CAAC;QAC/E,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB;IACN,qCAAe,GAAzB;QACE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,OAAO,EAAE,EAAhB,CAAgB,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,QAAQ,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAhRD,gBAAgB;IACC,4BAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,AAAtE,CAAuE;IAoT1G,kBAAC;CAAA,AA1UD,CAAiC,8BAAe,GA0U/C","sourcesContent":["/**\n * dd-resizable.ts 12.0.0\n * Copyright (c) 2021-2024 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, GridItemHTMLElement, 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 maxHeightMoveUp?: number;\n maxWidth?: number;\n maxWidthMoveLeft?: 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\ninterface RectScaleReciprocal {\n x: number;\n y: number;\n}\n\nexport class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt<DDResizableOpt> {\n /** @internal */\n protected handlers: DDResizableHandle[];\n /** @internal */\n protected originalRect: Rect;\n /** @internal */\n protected rectScale: RectScaleReciprocal = { x: 1, y: 1 };\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 /** @internal */\n protected sizeToContent: boolean;\n\n // have to be public else complains for HTMLElementExtendOpt ?\n constructor(public el: GridItemHTMLElement, public option: DDResizableOpt = {}) {\n super();\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 const updateHandles = (opts.handles && opts.handles !== this.option.handles);\n const 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 this.handlers = this.option.handles.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.sizeToContent = Utils.shouldSizeToContent(this.el.gridstackNode, true); // strick true only and not number\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 // Remove style attr now, so the stop handler can rebuild style attrs\n this._cleanHelper();\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 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\n const parent = this.el.parentElement;\n const dragTransform = Utils.getValuesFromTransformedElement(parent);\n this.rectScale = {\n x: dragTransform.xScale,\n y: dragTransform.yScale\n };\n\n if (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 = this.sizeToContent ? 0 : event.clientY - oEvent.clientY; // prevent vert resize\n let moveLeft: boolean;\n let moveUp: boolean;\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 moveLeft = true;\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 moveUp = true;\n }\n const constrain = this._constrainSize(newRect.width, newRect.height, moveLeft, moveUp);\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, moveLeft: boolean, moveUp: boolean): Size {\n const o = this.option;\n const maxWidth = (moveLeft ? o.maxWidthMoveLeft : o.maxWidth) || Number.MAX_SAFE_INTEGER;\n const minWidth = o.minWidth / this.rectScale.x || oWidth;\n const maxHeight = (moveUp ? o.maxHeightMoveUp : o.maxHeight) || Number.MAX_SAFE_INTEGER;\n const minHeight = o.minHeight / this.rectScale.y || 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 const scaleReciprocal = key === 'width' || key === 'left' ? this.rectScale.x : key === 'height' || key === 'top' ? this.rectScale.y : 1;\n this.el.style[key] = (value - containmentRect[key]) * scaleReciprocal + '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) * this.rectScale.x,\n top: (rect.top - containmentRect.top) * this.rectScale.y\n },\n size: {\n width: rect.width * this.rectScale.x,\n height: rect.height * this.rectScale.y\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 12.0.0
3
- * Copyright (c) 2021-2024 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;