gridstack 11.5.1 → 12.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.
- package/README.md +16 -3
- package/dist/angular/README.md +0 -1
- package/dist/angular/esm2020/lib/base-widget.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack-item.component.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack.component.mjs +2 -2
- package/dist/angular/esm2020/lib/gridstack.module.mjs +2 -2
- package/dist/angular/esm2020/lib/types.mjs +2 -2
- package/dist/angular/fesm2015/gridstack-angular.mjs +4 -4
- package/dist/angular/fesm2015/gridstack-angular.mjs.map +1 -1
- package/dist/angular/fesm2020/gridstack-angular.mjs +5 -5
- package/dist/angular/fesm2020/gridstack-angular.mjs.map +1 -1
- package/dist/angular/lib/gridstack-item.component.d.ts +1 -1
- package/dist/angular/lib/gridstack.component.d.ts +1 -1
- package/dist/angular/lib/types.d.ts +1 -1
- package/dist/angular/src/base-widget.ts +1 -1
- package/dist/angular/src/gridstack-item.component.ts +1 -1
- package/dist/angular/src/gridstack.component.ts +1 -1
- package/dist/angular/src/gridstack.module.ts +1 -1
- package/dist/dd-base-impl.d.ts +1 -1
- package/dist/dd-base-impl.js +1 -1
- package/dist/dd-base-impl.js.map +1 -1
- package/dist/dd-draggable.d.ts +1 -1
- package/dist/dd-draggable.js +1 -1
- package/dist/dd-draggable.js.map +1 -1
- package/dist/dd-droppable.d.ts +1 -1
- package/dist/dd-droppable.js +1 -1
- package/dist/dd-droppable.js.map +1 -1
- package/dist/dd-element.d.ts +1 -1
- package/dist/dd-element.js +1 -1
- package/dist/dd-element.js.map +1 -1
- package/dist/dd-gridstack.d.ts +1 -1
- package/dist/dd-gridstack.js +1 -1
- package/dist/dd-gridstack.js.map +1 -1
- package/dist/dd-manager.d.ts +1 -1
- package/dist/dd-manager.js +1 -1
- package/dist/dd-manager.js.map +1 -1
- package/dist/dd-resizable-handle.d.ts +1 -1
- package/dist/dd-resizable-handle.js +1 -1
- package/dist/dd-resizable-handle.js.map +1 -1
- package/dist/dd-resizable.d.ts +1 -1
- package/dist/dd-resizable.js +3 -2
- package/dist/dd-resizable.js.map +1 -1
- package/dist/dd-touch.d.ts +1 -1
- package/dist/dd-touch.js +1 -1
- package/dist/dd-touch.js.map +1 -1
- package/dist/gridstack-all.js +1 -1
- package/dist/gridstack-all.js.LICENSE.txt +1 -1
- package/dist/gridstack-all.js.map +1 -1
- package/dist/gridstack-engine.d.ts +1 -1
- package/dist/gridstack-engine.js +1 -1
- package/dist/gridstack-engine.js.map +1 -1
- package/dist/gridstack.css +25 -79
- package/dist/gridstack.d.ts +6 -5
- package/dist/gridstack.js +132 -203
- package/dist/gridstack.js.map +1 -1
- package/dist/gridstack.min.css +1 -1
- package/dist/src/gridstack.scss +22 -21
- package/dist/types.d.ts +4 -2
- package/dist/types.js +1 -2
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +1 -14
- package/dist/utils.js +1 -45
- package/dist/utils.js.map +1 -1
- package/doc/CHANGES.md +17 -0
- package/doc/README.md +0 -3
- package/package.json +2 -4
- package/dist/angular/node_modules/tslib/README.md +0 -164
- package/dist/es5/dd-base-impl.d.ts +0 -20
- package/dist/es5/dd-base-impl.js +0 -41
- package/dist/es5/dd-base-impl.js.map +0 -1
- package/dist/es5/dd-draggable.d.ts +0 -20
- package/dist/es5/dd-draggable.js +0 -408
- package/dist/es5/dd-draggable.js.map +0 -1
- package/dist/es5/dd-droppable.d.ts +0 -26
- package/dist/es5/dd-droppable.js +0 -185
- package/dist/es5/dd-droppable.js.map +0 -1
- package/dist/es5/dd-element.d.ts +0 -27
- package/dist/es5/dd-element.js +0 -96
- package/dist/es5/dd-element.js.map +0 -1
- package/dist/es5/dd-gridstack.d.ts +0 -34
- package/dist/es5/dd-gridstack.js +0 -154
- package/dist/es5/dd-gridstack.js.map +0 -1
- package/dist/es5/dd-manager.d.ts +0 -22
- package/dist/es5/dd-manager.js +0 -17
- package/dist/es5/dd-manager.js.map +0 -1
- package/dist/es5/dd-resizable-handle.d.ts +0 -18
- package/dist/es5/dd-resizable-handle.js +0 -117
- package/dist/es5/dd-resizable-handle.js.map +0 -1
- package/dist/es5/dd-resizable.d.ts +0 -30
- package/dist/es5/dd-resizable.js +0 -330
- package/dist/es5/dd-resizable.js.map +0 -1
- package/dist/es5/dd-touch.d.ts +0 -33
- package/dist/es5/dd-touch.js +0 -157
- package/dist/es5/dd-touch.js.map +0 -1
- package/dist/es5/gridstack-all.js +0 -3
- package/dist/es5/gridstack-all.js.LICENSE.txt +0 -7
- package/dist/es5/gridstack-all.js.map +0 -1
- package/dist/es5/gridstack-engine.d.ts +0 -107
- package/dist/es5/gridstack-engine.js +0 -1070
- package/dist/es5/gridstack-engine.js.map +0 -1
- package/dist/es5/gridstack-poly.js +0 -356
- package/dist/es5/gridstack.d.ts +0 -453
- package/dist/es5/gridstack.js +0 -2717
- package/dist/es5/gridstack.js.map +0 -1
- package/dist/es5/types.d.ts +0 -324
- package/dist/es5/types.js +0 -39
- package/dist/es5/types.js.map +0 -1
- package/dist/es5/utils.d.ts +0 -117
- package/dist/es5/utils.js +0 -677
- package/dist/es5/utils.js.map +0 -1
- package/dist/gridstack-extra.css +0 -373
- package/dist/gridstack-extra.min.css +0 -1
- package/dist/src/gridstack-extra.scss +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gridstack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Alain Dumesny <alaind831+github@gmail.com> (https://github.com/adumesny)",
|
|
6
6
|
"contributors": [
|
|
@@ -25,9 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "yarn --no-progress && yarn build:ng && grunt &&
|
|
29
|
-
"build:es6": "webpack && tsc --stripInternal",
|
|
30
|
-
"build:es5": "webpack --config es5/webpack.config.js && tsc --stripInternal --project es5/tsconfig.json",
|
|
28
|
+
"build": "yarn --no-progress && yarn build:ng && grunt && webpack && tsc --stripInternal && yarn doc",
|
|
31
29
|
"build:ng": "cd angular && yarn --no-progress && yarn build lib",
|
|
32
30
|
"w": "webpack",
|
|
33
31
|
"t": "rm -rf dist/* && grunt && tsc --stripInternal",
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# tslib
|
|
2
|
-
|
|
3
|
-
This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
|
|
4
|
-
|
|
5
|
-
This library is primarily used by the `--importHelpers` flag in TypeScript.
|
|
6
|
-
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
|
10
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
11
|
-
s = arguments[i];
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
}
|
|
15
|
-
return t;
|
|
16
|
-
};
|
|
17
|
-
exports.x = {};
|
|
18
|
-
exports.y = __assign({}, exports.x);
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
will instead be emitted as something like the following:
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
var tslib_1 = require("tslib");
|
|
26
|
-
exports.x = {};
|
|
27
|
-
exports.y = tslib_1.__assign({}, exports.x);
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
|
|
31
|
-
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
|
|
32
|
-
|
|
33
|
-
# Installing
|
|
34
|
-
|
|
35
|
-
For the latest stable version, run:
|
|
36
|
-
|
|
37
|
-
## npm
|
|
38
|
-
|
|
39
|
-
```sh
|
|
40
|
-
# TypeScript 3.9.2 or later
|
|
41
|
-
npm install tslib
|
|
42
|
-
|
|
43
|
-
# TypeScript 3.8.4 or earlier
|
|
44
|
-
npm install tslib@^1
|
|
45
|
-
|
|
46
|
-
# TypeScript 2.3.2 or earlier
|
|
47
|
-
npm install tslib@1.6.1
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## yarn
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
# TypeScript 3.9.2 or later
|
|
54
|
-
yarn add tslib
|
|
55
|
-
|
|
56
|
-
# TypeScript 3.8.4 or earlier
|
|
57
|
-
yarn add tslib@^1
|
|
58
|
-
|
|
59
|
-
# TypeScript 2.3.2 or earlier
|
|
60
|
-
yarn add tslib@1.6.1
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## bower
|
|
64
|
-
|
|
65
|
-
```sh
|
|
66
|
-
# TypeScript 3.9.2 or later
|
|
67
|
-
bower install tslib
|
|
68
|
-
|
|
69
|
-
# TypeScript 3.8.4 or earlier
|
|
70
|
-
bower install tslib@^1
|
|
71
|
-
|
|
72
|
-
# TypeScript 2.3.2 or earlier
|
|
73
|
-
bower install tslib@1.6.1
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## JSPM
|
|
77
|
-
|
|
78
|
-
```sh
|
|
79
|
-
# TypeScript 3.9.2 or later
|
|
80
|
-
jspm install tslib
|
|
81
|
-
|
|
82
|
-
# TypeScript 3.8.4 or earlier
|
|
83
|
-
jspm install tslib@^1
|
|
84
|
-
|
|
85
|
-
# TypeScript 2.3.2 or earlier
|
|
86
|
-
jspm install tslib@1.6.1
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
# Usage
|
|
90
|
-
|
|
91
|
-
Set the `importHelpers` compiler option on the command line:
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
tsc --importHelpers file.ts
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
or in your tsconfig.json:
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"compilerOptions": {
|
|
102
|
-
"importHelpers": true
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
#### For bower and JSPM users
|
|
108
|
-
|
|
109
|
-
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
|
|
110
|
-
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"compilerOptions": {
|
|
114
|
-
"module": "amd",
|
|
115
|
-
"importHelpers": true,
|
|
116
|
-
"baseUrl": "./",
|
|
117
|
-
"paths": {
|
|
118
|
-
"tslib" : ["bower_components/tslib/tslib.d.ts"]
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
For JSPM users:
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"compilerOptions": {
|
|
129
|
-
"module": "system",
|
|
130
|
-
"importHelpers": true,
|
|
131
|
-
"baseUrl": "./",
|
|
132
|
-
"paths": {
|
|
133
|
-
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Deployment
|
|
140
|
-
|
|
141
|
-
- Choose your new version number
|
|
142
|
-
- Set it in `package.json` and `bower.json`
|
|
143
|
-
- Create a tag: `git tag [version]`
|
|
144
|
-
- Push the tag: `git push --tags`
|
|
145
|
-
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
|
|
146
|
-
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
|
|
147
|
-
|
|
148
|
-
Done.
|
|
149
|
-
|
|
150
|
-
# Contribute
|
|
151
|
-
|
|
152
|
-
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
|
|
153
|
-
|
|
154
|
-
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
|
|
155
|
-
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
|
|
156
|
-
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
|
|
157
|
-
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
|
|
158
|
-
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
|
159
|
-
|
|
160
|
-
# Documentation
|
|
161
|
-
|
|
162
|
-
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
|
|
163
|
-
* [Programming handbook](http://www.typescriptlang.org/Handbook)
|
|
164
|
-
* [Homepage](http://www.typescriptlang.org/)
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dd-base-impl.ts 11.5.1
|
|
3
|
-
* Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
|
|
4
|
-
*/
|
|
5
|
-
export type EventCallback = (event: Event) => boolean | void;
|
|
6
|
-
export declare abstract class DDBaseImplement {
|
|
7
|
-
/** returns the enable state, but you have to call enable()/disable() to change (as other things need to happen) */
|
|
8
|
-
get disabled(): boolean;
|
|
9
|
-
on(event: string, callback: EventCallback): void;
|
|
10
|
-
off(event: string): void;
|
|
11
|
-
enable(): void;
|
|
12
|
-
disable(): void;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
triggerEvent(eventName: string, event: Event): boolean | void;
|
|
15
|
-
}
|
|
16
|
-
export interface HTMLElementExtendOpt<T> {
|
|
17
|
-
el: HTMLElement;
|
|
18
|
-
option: T;
|
|
19
|
-
updateOption(T: any): DDBaseImplement;
|
|
20
|
-
}
|
package/dist/es5/dd-base-impl.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* dd-base-impl.ts 11.5.1
|
|
4
|
-
* Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DDBaseImplement = void 0;
|
|
8
|
-
var DDBaseImplement = /** @class */ (function () {
|
|
9
|
-
function DDBaseImplement() {
|
|
10
|
-
/** @internal */
|
|
11
|
-
this._eventRegister = {};
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(DDBaseImplement.prototype, "disabled", {
|
|
14
|
-
/** returns the enable state, but you have to call enable()/disable() to change (as other things need to happen) */
|
|
15
|
-
get: function () { return this._disabled; },
|
|
16
|
-
enumerable: false,
|
|
17
|
-
configurable: true
|
|
18
|
-
});
|
|
19
|
-
DDBaseImplement.prototype.on = function (event, callback) {
|
|
20
|
-
this._eventRegister[event] = callback;
|
|
21
|
-
};
|
|
22
|
-
DDBaseImplement.prototype.off = function (event) {
|
|
23
|
-
delete this._eventRegister[event];
|
|
24
|
-
};
|
|
25
|
-
DDBaseImplement.prototype.enable = function () {
|
|
26
|
-
this._disabled = false;
|
|
27
|
-
};
|
|
28
|
-
DDBaseImplement.prototype.disable = function () {
|
|
29
|
-
this._disabled = true;
|
|
30
|
-
};
|
|
31
|
-
DDBaseImplement.prototype.destroy = function () {
|
|
32
|
-
delete this._eventRegister;
|
|
33
|
-
};
|
|
34
|
-
DDBaseImplement.prototype.triggerEvent = function (eventName, event) {
|
|
35
|
-
if (!this.disabled && this._eventRegister && this._eventRegister[eventName])
|
|
36
|
-
return this._eventRegister[eventName](event);
|
|
37
|
-
};
|
|
38
|
-
return DDBaseImplement;
|
|
39
|
-
}());
|
|
40
|
-
exports.DDBaseImplement = DDBaseImplement;
|
|
41
|
-
//# sourceMappingURL=dd-base-impl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dd-base-impl.js","sourceRoot":"","sources":["../../src/dd-base-impl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH;IAAA;QAME,gBAAgB;QACN,mBAAc,GAEpB,EAAE,CAAC;IA0BT,CAAC;IAjCC,sBAAW,qCAAQ;QADnB,mHAAmH;aACnH,cAAmC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;;;OAAA;IASpD,4BAAE,GAAT,UAAU,KAAa,EAAE,QAAuB;QAC9C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;IACxC,CAAC;IAEM,6BAAG,GAAV,UAAW,KAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAEM,gCAAM,GAAb;QACE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAEM,iCAAO,GAAd;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAEM,iCAAO,GAAd;QACE,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,sCAAY,GAAnB,UAAoB,SAAiB,EAAE,KAAY;QACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;YACzE,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IACH,sBAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCqB,0CAAe","sourcesContent":["/**\n * dd-base-impl.ts 11.5.1\n * Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license\n */\n\nexport type EventCallback = (event: Event) => boolean|void;\nexport abstract class DDBaseImplement {\n /** returns the enable state, but you have to call enable()/disable() to change (as other things need to happen) */\n public get disabled(): boolean { return this._disabled; }\n\n /** @internal */\n protected _disabled: boolean; // initial state to differentiate from false\n /** @internal */\n protected _eventRegister: {\n [eventName: string]: EventCallback;\n } = {};\n\n public on(event: string, callback: EventCallback): void {\n this._eventRegister[event] = callback;\n }\n\n public off(event: string): void {\n delete this._eventRegister[event];\n }\n\n public enable(): void {\n this._disabled = false;\n }\n\n public disable(): void {\n this._disabled = true;\n }\n\n public destroy(): void {\n delete this._eventRegister;\n }\n\n public triggerEvent(eventName: string, event: Event): boolean|void {\n if (!this.disabled && this._eventRegister && this._eventRegister[eventName])\n return this._eventRegister[eventName](event);\n }\n}\n\nexport interface HTMLElementExtendOpt<T> {\n el: HTMLElement;\n option: T;\n updateOption(T): DDBaseImplement;\n}\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dd-draggable.ts 11.5.1
|
|
3
|
-
* Copyright (c) 2021-2024 Alain Dumesny - see GridStack root license
|
|
4
|
-
*/
|
|
5
|
-
import { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';
|
|
6
|
-
import { GridItemHTMLElement, DDDragOpt } from './types';
|
|
7
|
-
type DDDragEvent = 'drag' | 'dragstart' | 'dragstop';
|
|
8
|
-
export declare class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt<DDDragOpt> {
|
|
9
|
-
el: GridItemHTMLElement;
|
|
10
|
-
option: DDDragOpt;
|
|
11
|
-
helper: HTMLElement;
|
|
12
|
-
constructor(el: GridItemHTMLElement, option?: DDDragOpt);
|
|
13
|
-
on(event: DDDragEvent, callback: (event: DragEvent) => void): void;
|
|
14
|
-
off(event: DDDragEvent): void;
|
|
15
|
-
enable(): void;
|
|
16
|
-
disable(forDestroy?: boolean): void;
|
|
17
|
-
destroy(): void;
|
|
18
|
-
updateOption(opts: DDDragOpt): DDDraggable;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
package/dist/es5/dd-draggable.js
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* dd-draggable.ts 11.5.1
|
|
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
|
-
var __assign = (this && this.__assign) || function () {
|
|
22
|
-
__assign = Object.assign || function(t) {
|
|
23
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
24
|
-
s = arguments[i];
|
|
25
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
26
|
-
t[p] = s[p];
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
};
|
|
30
|
-
return __assign.apply(this, arguments);
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.DDDraggable = void 0;
|
|
34
|
-
var dd_manager_1 = require("./dd-manager");
|
|
35
|
-
var utils_1 = require("./utils");
|
|
36
|
-
var dd_base_impl_1 = require("./dd-base-impl");
|
|
37
|
-
var dd_touch_1 = require("./dd-touch");
|
|
38
|
-
// make sure we are not clicking on known object that handles mouseDown
|
|
39
|
-
var skipMouseDown = 'input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';
|
|
40
|
-
// let count = 0; // TEST
|
|
41
|
-
var DDDraggable = exports.DDDraggable = /** @class */ (function (_super) {
|
|
42
|
-
__extends(DDDraggable, _super);
|
|
43
|
-
function DDDraggable(el, option) {
|
|
44
|
-
if (option === void 0) { option = {}; }
|
|
45
|
-
var _this = this;
|
|
46
|
-
var _a;
|
|
47
|
-
_this = _super.call(this) || this;
|
|
48
|
-
_this.el = el;
|
|
49
|
-
_this.option = option;
|
|
50
|
-
/** @internal */
|
|
51
|
-
_this.dragTransform = {
|
|
52
|
-
xScale: 1,
|
|
53
|
-
yScale: 1,
|
|
54
|
-
xOffset: 0,
|
|
55
|
-
yOffset: 0
|
|
56
|
-
};
|
|
57
|
-
// get the element that is actually supposed to be dragged by
|
|
58
|
-
var handleName = (_a = option === null || option === void 0 ? void 0 : option.handle) === null || _a === void 0 ? void 0 : _a.substring(1);
|
|
59
|
-
var n = el.gridstackNode;
|
|
60
|
-
_this.dragEls = !handleName || el.classList.contains(handleName) ? [el] : ((n === null || n === void 0 ? void 0 : n.subGrid) ? [el.querySelector(option.handle) || el] : Array.from(el.querySelectorAll(option.handle)));
|
|
61
|
-
if (_this.dragEls.length === 0) {
|
|
62
|
-
_this.dragEls = [el];
|
|
63
|
-
}
|
|
64
|
-
// create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)
|
|
65
|
-
_this._mouseDown = _this._mouseDown.bind(_this);
|
|
66
|
-
_this._mouseMove = _this._mouseMove.bind(_this);
|
|
67
|
-
_this._mouseUp = _this._mouseUp.bind(_this);
|
|
68
|
-
_this._keyEvent = _this._keyEvent.bind(_this);
|
|
69
|
-
_this.enable();
|
|
70
|
-
return _this;
|
|
71
|
-
}
|
|
72
|
-
DDDraggable.prototype.on = function (event, callback) {
|
|
73
|
-
_super.prototype.on.call(this, event, callback);
|
|
74
|
-
};
|
|
75
|
-
DDDraggable.prototype.off = function (event) {
|
|
76
|
-
_super.prototype.off.call(this, event);
|
|
77
|
-
};
|
|
78
|
-
DDDraggable.prototype.enable = function () {
|
|
79
|
-
var _this = this;
|
|
80
|
-
if (this.disabled === false)
|
|
81
|
-
return;
|
|
82
|
-
_super.prototype.enable.call(this);
|
|
83
|
-
this.dragEls.forEach(function (dragEl) {
|
|
84
|
-
dragEl.addEventListener('mousedown', _this._mouseDown);
|
|
85
|
-
if (dd_touch_1.isTouch) {
|
|
86
|
-
dragEl.addEventListener('touchstart', dd_touch_1.touchstart);
|
|
87
|
-
dragEl.addEventListener('pointerdown', dd_touch_1.pointerdown);
|
|
88
|
-
// dragEl.style.touchAction = 'none'; // not needed unlike pointerdown doc comment
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
this.el.classList.remove('ui-draggable-disabled');
|
|
92
|
-
};
|
|
93
|
-
DDDraggable.prototype.disable = function (forDestroy) {
|
|
94
|
-
var _this = this;
|
|
95
|
-
if (forDestroy === void 0) { forDestroy = false; }
|
|
96
|
-
if (this.disabled === true)
|
|
97
|
-
return;
|
|
98
|
-
_super.prototype.disable.call(this);
|
|
99
|
-
this.dragEls.forEach(function (dragEl) {
|
|
100
|
-
dragEl.removeEventListener('mousedown', _this._mouseDown);
|
|
101
|
-
if (dd_touch_1.isTouch) {
|
|
102
|
-
dragEl.removeEventListener('touchstart', dd_touch_1.touchstart);
|
|
103
|
-
dragEl.removeEventListener('pointerdown', dd_touch_1.pointerdown);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
if (!forDestroy)
|
|
107
|
-
this.el.classList.add('ui-draggable-disabled');
|
|
108
|
-
};
|
|
109
|
-
DDDraggable.prototype.destroy = function () {
|
|
110
|
-
if (this.dragTimeout)
|
|
111
|
-
window.clearTimeout(this.dragTimeout);
|
|
112
|
-
delete this.dragTimeout;
|
|
113
|
-
if (this.mouseDownEvent)
|
|
114
|
-
this._mouseUp(this.mouseDownEvent);
|
|
115
|
-
this.disable(true);
|
|
116
|
-
delete this.el;
|
|
117
|
-
delete this.helper;
|
|
118
|
-
delete this.option;
|
|
119
|
-
_super.prototype.destroy.call(this);
|
|
120
|
-
};
|
|
121
|
-
DDDraggable.prototype.updateOption = function (opts) {
|
|
122
|
-
var _this = this;
|
|
123
|
-
Object.keys(opts).forEach(function (key) { return _this.option[key] = opts[key]; });
|
|
124
|
-
return this;
|
|
125
|
-
};
|
|
126
|
-
/** @internal call when mouse goes down before a dragstart happens */
|
|
127
|
-
DDDraggable.prototype._mouseDown = function (e) {
|
|
128
|
-
// don't let more than one widget handle mouseStart
|
|
129
|
-
if (dd_manager_1.DDManager.mouseHandled)
|
|
130
|
-
return;
|
|
131
|
-
if (e.button !== 0)
|
|
132
|
-
return true; // only left click
|
|
133
|
-
// make sure we are not clicking on known object that handles mouseDown, or ones supplied by the user
|
|
134
|
-
if (!this.dragEls.find(function (el) { return el === e.target; }) && e.target.closest(skipMouseDown))
|
|
135
|
-
return true;
|
|
136
|
-
if (this.option.cancel) {
|
|
137
|
-
if (e.target.closest(this.option.cancel))
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
this.mouseDownEvent = e;
|
|
141
|
-
delete this.dragging;
|
|
142
|
-
delete dd_manager_1.DDManager.dragElement;
|
|
143
|
-
delete dd_manager_1.DDManager.dropElement;
|
|
144
|
-
// document handler so we can continue receiving moves as the item is 'fixed' position, and capture=true so WE get a first crack
|
|
145
|
-
document.addEventListener('mousemove', this._mouseMove, { capture: true, passive: true }); // true=capture, not bubble
|
|
146
|
-
document.addEventListener('mouseup', this._mouseUp, true);
|
|
147
|
-
if (dd_touch_1.isTouch) {
|
|
148
|
-
e.currentTarget.addEventListener('touchmove', dd_touch_1.touchmove);
|
|
149
|
-
e.currentTarget.addEventListener('touchend', dd_touch_1.touchend);
|
|
150
|
-
}
|
|
151
|
-
e.preventDefault();
|
|
152
|
-
// preventDefault() prevents blur event which occurs just after mousedown event.
|
|
153
|
-
// if an editable content has focus, then blur must be call
|
|
154
|
-
if (document.activeElement)
|
|
155
|
-
document.activeElement.blur();
|
|
156
|
-
dd_manager_1.DDManager.mouseHandled = true;
|
|
157
|
-
return true;
|
|
158
|
-
};
|
|
159
|
-
/** @internal method to call actual drag event */
|
|
160
|
-
DDDraggable.prototype._callDrag = function (e) {
|
|
161
|
-
if (!this.dragging)
|
|
162
|
-
return;
|
|
163
|
-
var ev = utils_1.Utils.initEvent(e, { target: this.el, type: 'drag' });
|
|
164
|
-
if (this.option.drag) {
|
|
165
|
-
this.option.drag(ev, this.ui());
|
|
166
|
-
}
|
|
167
|
-
this.triggerEvent('drag', ev);
|
|
168
|
-
};
|
|
169
|
-
/** @internal called when the main page (after successful mousedown) receives a move event to drag the item around the screen */
|
|
170
|
-
DDDraggable.prototype._mouseMove = function (e) {
|
|
171
|
-
var _this = this;
|
|
172
|
-
var _a;
|
|
173
|
-
// console.log(`${count++} move ${e.x},${e.y}`)
|
|
174
|
-
var s = this.mouseDownEvent;
|
|
175
|
-
this.lastDrag = e;
|
|
176
|
-
if (this.dragging) {
|
|
177
|
-
this._dragFollow(e);
|
|
178
|
-
// delay actual grid handling drag until we pause for a while if set
|
|
179
|
-
if (dd_manager_1.DDManager.pauseDrag) {
|
|
180
|
-
var pause = Number.isInteger(dd_manager_1.DDManager.pauseDrag) ? dd_manager_1.DDManager.pauseDrag : 100;
|
|
181
|
-
if (this.dragTimeout)
|
|
182
|
-
window.clearTimeout(this.dragTimeout);
|
|
183
|
-
this.dragTimeout = window.setTimeout(function () { return _this._callDrag(e); }, pause);
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
this._callDrag(e);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
else if (Math.abs(e.x - s.x) + Math.abs(e.y - s.y) > 3) {
|
|
190
|
-
/**
|
|
191
|
-
* don't start unless we've moved at least 3 pixels
|
|
192
|
-
*/
|
|
193
|
-
this.dragging = true;
|
|
194
|
-
dd_manager_1.DDManager.dragElement = this;
|
|
195
|
-
// if we're dragging an actual grid item, set the current drop as the grid (to detect enter/leave)
|
|
196
|
-
var grid = (_a = this.el.gridstackNode) === null || _a === void 0 ? void 0 : _a.grid;
|
|
197
|
-
if (grid) {
|
|
198
|
-
dd_manager_1.DDManager.dropElement = grid.el.ddElement.ddDroppable;
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
delete dd_manager_1.DDManager.dropElement;
|
|
202
|
-
}
|
|
203
|
-
this.helper = this._createHelper();
|
|
204
|
-
this._setupHelperContainmentStyle();
|
|
205
|
-
this.dragTransform = utils_1.Utils.getValuesFromTransformedElement(this.helperContainment);
|
|
206
|
-
this.dragOffset = this._getDragOffset(e, this.el, this.helperContainment);
|
|
207
|
-
this._setupHelperStyle(e);
|
|
208
|
-
var ev = utils_1.Utils.initEvent(e, { target: this.el, type: 'dragstart' });
|
|
209
|
-
if (this.option.start) {
|
|
210
|
-
this.option.start(ev, this.ui());
|
|
211
|
-
}
|
|
212
|
-
this.triggerEvent('dragstart', ev);
|
|
213
|
-
// now track keyboard events to cancel or rotate
|
|
214
|
-
document.addEventListener('keydown', this._keyEvent);
|
|
215
|
-
}
|
|
216
|
-
// e.preventDefault(); // passive = true. OLD: was needed otherwise we get text sweep text selection as we drag around
|
|
217
|
-
return true;
|
|
218
|
-
};
|
|
219
|
-
/** @internal call when the mouse gets released to drop the item at current location */
|
|
220
|
-
DDDraggable.prototype._mouseUp = function (e) {
|
|
221
|
-
var _a, _b;
|
|
222
|
-
document.removeEventListener('mousemove', this._mouseMove, true);
|
|
223
|
-
document.removeEventListener('mouseup', this._mouseUp, true);
|
|
224
|
-
if (dd_touch_1.isTouch && e.currentTarget) { // destroy() during nested grid call us again wit fake _mouseUp
|
|
225
|
-
e.currentTarget.removeEventListener('touchmove', dd_touch_1.touchmove, true);
|
|
226
|
-
e.currentTarget.removeEventListener('touchend', dd_touch_1.touchend, true);
|
|
227
|
-
}
|
|
228
|
-
if (this.dragging) {
|
|
229
|
-
delete this.dragging;
|
|
230
|
-
(_a = this.el.gridstackNode) === null || _a === void 0 ? true : delete _a._origRotate;
|
|
231
|
-
document.removeEventListener('keydown', this._keyEvent);
|
|
232
|
-
// reset the drop target if dragging over ourself (already parented, just moving during stop callback below)
|
|
233
|
-
if (((_b = dd_manager_1.DDManager.dropElement) === null || _b === void 0 ? void 0 : _b.el) === this.el.parentElement) {
|
|
234
|
-
delete dd_manager_1.DDManager.dropElement;
|
|
235
|
-
}
|
|
236
|
-
this.helperContainment.style.position = this.parentOriginStylePosition || null;
|
|
237
|
-
if (this.helper !== this.el)
|
|
238
|
-
this.helper.remove(); // hide now
|
|
239
|
-
this._removeHelperStyle();
|
|
240
|
-
var ev = utils_1.Utils.initEvent(e, { target: this.el, type: 'dragstop' });
|
|
241
|
-
if (this.option.stop) {
|
|
242
|
-
this.option.stop(ev); // NOTE: destroy() will be called when removing item, so expect NULL ptr after!
|
|
243
|
-
}
|
|
244
|
-
this.triggerEvent('dragstop', ev);
|
|
245
|
-
// call the droppable method to receive the item
|
|
246
|
-
if (dd_manager_1.DDManager.dropElement) {
|
|
247
|
-
dd_manager_1.DDManager.dropElement.drop(e);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
delete this.helper;
|
|
251
|
-
delete this.mouseDownEvent;
|
|
252
|
-
delete dd_manager_1.DDManager.dragElement;
|
|
253
|
-
delete dd_manager_1.DDManager.dropElement;
|
|
254
|
-
delete dd_manager_1.DDManager.mouseHandled;
|
|
255
|
-
e.preventDefault();
|
|
256
|
-
};
|
|
257
|
-
/** @internal call when keys are being pressed - use Esc to cancel, R to rotate */
|
|
258
|
-
DDDraggable.prototype._keyEvent = function (e) {
|
|
259
|
-
var _a, _b;
|
|
260
|
-
var n = this.el.gridstackNode;
|
|
261
|
-
var grid = (n === null || n === void 0 ? void 0 : n.grid) || ((_b = (_a = dd_manager_1.DDManager.dropElement) === null || _a === void 0 ? void 0 : _a.el) === null || _b === void 0 ? void 0 : _b.gridstack);
|
|
262
|
-
if (e.key === 'Escape') {
|
|
263
|
-
if (n && n._origRotate) {
|
|
264
|
-
n._orig = n._origRotate;
|
|
265
|
-
delete n._origRotate;
|
|
266
|
-
}
|
|
267
|
-
grid === null || grid === void 0 ? void 0 : grid.cancelDrag();
|
|
268
|
-
this._mouseUp(this.mouseDownEvent);
|
|
269
|
-
}
|
|
270
|
-
else if (n && grid && (e.key === 'r' || e.key === 'R')) {
|
|
271
|
-
if (!utils_1.Utils.canBeRotated(n))
|
|
272
|
-
return;
|
|
273
|
-
n._origRotate = n._origRotate || __assign({}, n._orig); // store the real orig size in case we Esc after doing rotation
|
|
274
|
-
delete n._moving; // force rotate to happen (move waits for >50% coverage otherwise)
|
|
275
|
-
grid.setAnimation(false) // immediate rotate so _getDragOffset() gets the right dom size below
|
|
276
|
-
.rotate(n.el, { top: -this.dragOffset.offsetTop, left: -this.dragOffset.offsetLeft })
|
|
277
|
-
.setAnimation();
|
|
278
|
-
n._moving = true;
|
|
279
|
-
this.dragOffset = this._getDragOffset(this.lastDrag, n.el, this.helperContainment);
|
|
280
|
-
this.helper.style.width = this.dragOffset.width + 'px';
|
|
281
|
-
this.helper.style.height = this.dragOffset.height + 'px';
|
|
282
|
-
utils_1.Utils.swap(n._orig, 'w', 'h');
|
|
283
|
-
delete n._rect;
|
|
284
|
-
this._mouseMove(this.lastDrag);
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
/** @internal create a clone copy (or user defined method) of the original drag item if set */
|
|
288
|
-
DDDraggable.prototype._createHelper = function () {
|
|
289
|
-
var _this = this;
|
|
290
|
-
var helper = this.el;
|
|
291
|
-
if (typeof this.option.helper === 'function') {
|
|
292
|
-
helper = this.option.helper(this.el);
|
|
293
|
-
}
|
|
294
|
-
else if (this.option.helper === 'clone') {
|
|
295
|
-
helper = utils_1.Utils.cloneNode(this.el);
|
|
296
|
-
}
|
|
297
|
-
if (!helper.parentElement) {
|
|
298
|
-
utils_1.Utils.appendTo(helper, this.option.appendTo === 'parent' ? this.el.parentElement : this.option.appendTo);
|
|
299
|
-
}
|
|
300
|
-
this.dragElementOriginStyle = DDDraggable.originStyleProp.map(function (prop) { return _this.el.style[prop]; });
|
|
301
|
-
return helper;
|
|
302
|
-
};
|
|
303
|
-
/** @internal set the fix position of the dragged item */
|
|
304
|
-
DDDraggable.prototype._setupHelperStyle = function (e) {
|
|
305
|
-
var _this = this;
|
|
306
|
-
this.helper.classList.add('ui-draggable-dragging');
|
|
307
|
-
// TODO: set all at once with style.cssText += ... ? https://stackoverflow.com/questions/3968593
|
|
308
|
-
var style = this.helper.style;
|
|
309
|
-
style.pointerEvents = 'none'; // needed for over items to get enter/leave
|
|
310
|
-
// style.cursor = 'move'; // TODO: can't set with pointerEvents=none ! (done in CSS as well)
|
|
311
|
-
style.width = this.dragOffset.width + 'px';
|
|
312
|
-
style.height = this.dragOffset.height + 'px';
|
|
313
|
-
style.willChange = 'left, top';
|
|
314
|
-
style.position = 'fixed'; // let us drag between grids by not clipping as parent .grid-stack is position: 'relative'
|
|
315
|
-
this._dragFollow(e); // now position it
|
|
316
|
-
style.transition = 'none'; // show up instantly
|
|
317
|
-
setTimeout(function () {
|
|
318
|
-
if (_this.helper) {
|
|
319
|
-
style.transition = null; // recover animation
|
|
320
|
-
}
|
|
321
|
-
}, 0);
|
|
322
|
-
return this;
|
|
323
|
-
};
|
|
324
|
-
/** @internal restore back the original style before dragging */
|
|
325
|
-
DDDraggable.prototype._removeHelperStyle = function () {
|
|
326
|
-
var _this = this;
|
|
327
|
-
var _a;
|
|
328
|
-
this.helper.classList.remove('ui-draggable-dragging');
|
|
329
|
-
var node = (_a = this.helper) === null || _a === void 0 ? void 0 : _a.gridstackNode;
|
|
330
|
-
// don't bother restoring styles if we're gonna remove anyway...
|
|
331
|
-
if (!(node === null || node === void 0 ? void 0 : node._isAboutToRemove) && this.dragElementOriginStyle) {
|
|
332
|
-
var helper_1 = this.helper;
|
|
333
|
-
// don't animate, otherwise we animate offseted when switching back to 'absolute' from 'fixed'.
|
|
334
|
-
// TODO: this also removes resizing animation which doesn't have this issue, but others.
|
|
335
|
-
// Ideally both would animate ('move' would immediately restore 'absolute' and adjust coordinate to match,
|
|
336
|
-
// then trigger a delay (repaint) to restore to final dest with animate) but then we need to make sure 'resizestop'
|
|
337
|
-
// is called AFTER 'transitionend' event is received (see https://github.com/gridstack/gridstack.js/issues/2033)
|
|
338
|
-
var transition_1 = this.dragElementOriginStyle['transition'] || null;
|
|
339
|
-
helper_1.style.transition = this.dragElementOriginStyle['transition'] = 'none'; // can't be NULL #1973
|
|
340
|
-
DDDraggable.originStyleProp.forEach(function (prop) { return helper_1.style[prop] = _this.dragElementOriginStyle[prop] || null; });
|
|
341
|
-
setTimeout(function () { return helper_1.style.transition = transition_1; }, 50); // recover animation from saved vars after a pause (0 isn't enough #1973)
|
|
342
|
-
}
|
|
343
|
-
delete this.dragElementOriginStyle;
|
|
344
|
-
return this;
|
|
345
|
-
};
|
|
346
|
-
/** @internal updates the top/left position to follow the mouse */
|
|
347
|
-
DDDraggable.prototype._dragFollow = function (e) {
|
|
348
|
-
var containmentRect = { left: 0, top: 0 };
|
|
349
|
-
// if (this.helper.style.position === 'absolute') { // we use 'fixed'
|
|
350
|
-
// const { left, top } = this.helperContainment.getBoundingClientRect();
|
|
351
|
-
// containmentRect = { left, top };
|
|
352
|
-
// }
|
|
353
|
-
var style = this.helper.style;
|
|
354
|
-
var offset = this.dragOffset;
|
|
355
|
-
style.left = (e.clientX + offset.offsetLeft - containmentRect.left) * this.dragTransform.xScale + 'px';
|
|
356
|
-
style.top = (e.clientY + offset.offsetTop - containmentRect.top) * this.dragTransform.yScale + 'px';
|
|
357
|
-
};
|
|
358
|
-
/** @internal */
|
|
359
|
-
DDDraggable.prototype._setupHelperContainmentStyle = function () {
|
|
360
|
-
this.helperContainment = this.helper.parentElement;
|
|
361
|
-
if (this.helper.style.position !== 'fixed') {
|
|
362
|
-
this.parentOriginStylePosition = this.helperContainment.style.position;
|
|
363
|
-
if (getComputedStyle(this.helperContainment).position.match(/static/)) {
|
|
364
|
-
this.helperContainment.style.position = 'relative';
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return this;
|
|
368
|
-
};
|
|
369
|
-
/** @internal */
|
|
370
|
-
DDDraggable.prototype._getDragOffset = function (event, el, parent) {
|
|
371
|
-
// in case ancestor has transform/perspective css properties that change the viewpoint
|
|
372
|
-
var xformOffsetX = 0;
|
|
373
|
-
var xformOffsetY = 0;
|
|
374
|
-
if (parent) {
|
|
375
|
-
xformOffsetX = this.dragTransform.xOffset;
|
|
376
|
-
xformOffsetY = this.dragTransform.yOffset;
|
|
377
|
-
}
|
|
378
|
-
var targetOffset = el.getBoundingClientRect();
|
|
379
|
-
return {
|
|
380
|
-
left: targetOffset.left,
|
|
381
|
-
top: targetOffset.top,
|
|
382
|
-
offsetLeft: -event.clientX + targetOffset.left - xformOffsetX,
|
|
383
|
-
offsetTop: -event.clientY + targetOffset.top - xformOffsetY,
|
|
384
|
-
width: targetOffset.width * this.dragTransform.xScale,
|
|
385
|
-
height: targetOffset.height * this.dragTransform.yScale
|
|
386
|
-
};
|
|
387
|
-
};
|
|
388
|
-
/** @internal TODO: set to public as called by DDDroppable! */
|
|
389
|
-
DDDraggable.prototype.ui = function () {
|
|
390
|
-
var containmentEl = this.el.parentElement;
|
|
391
|
-
var containmentRect = containmentEl.getBoundingClientRect();
|
|
392
|
-
var offset = this.helper.getBoundingClientRect();
|
|
393
|
-
return {
|
|
394
|
-
position: {
|
|
395
|
-
top: (offset.top - containmentRect.top) * this.dragTransform.yScale,
|
|
396
|
-
left: (offset.left - containmentRect.left) * this.dragTransform.xScale
|
|
397
|
-
}
|
|
398
|
-
/* not used by GridStack for now...
|
|
399
|
-
helper: [this.helper], //The object arr representing the helper that's being dragged.
|
|
400
|
-
offset: { top: offset.top, left: offset.left } // Current offset position of the helper as { top, left } object.
|
|
401
|
-
*/
|
|
402
|
-
};
|
|
403
|
-
};
|
|
404
|
-
/** @internal properties we change during dragging, and restore back */
|
|
405
|
-
DDDraggable.originStyleProp = ['width', 'height', 'transform', 'transform-origin', 'transition', 'pointerEvents', 'position', 'left', 'top', 'minWidth', 'willChange'];
|
|
406
|
-
return DDDraggable;
|
|
407
|
-
}(dd_base_impl_1.DDBaseImplement));
|
|
408
|
-
//# sourceMappingURL=dd-draggable.js.map
|