@itrocks/table 0.2.7 → 0.2.8
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/column-reorder.js +7 -8
- package/package.json +1 -1
package/column-reorder.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Plugin } from '../plugin/plugin.js';
|
|
2
2
|
import { PluginOptions } from '../plugin/plugin.js';
|
|
3
|
+
let activeDrag;
|
|
3
4
|
const clamp = (value) => Math.max(0, Math.min(1, value));
|
|
4
5
|
const maxScrollSpeed = 800;
|
|
5
6
|
const penetration = 10;
|
|
6
7
|
const scrollZone = 50;
|
|
7
|
-
let activeDrag;
|
|
8
8
|
export class TableColumnReorder extends Plugin {
|
|
9
9
|
drag;
|
|
10
10
|
frame;
|
|
@@ -14,27 +14,26 @@ export class TableColumnReorder extends Plugin {
|
|
|
14
14
|
this.frame = undefined;
|
|
15
15
|
const drag = this.drag;
|
|
16
16
|
this.updateState(drag);
|
|
17
|
-
if (drag.remove) {
|
|
18
|
-
drag.time = undefined;
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
17
|
const pointerDirection = drag.direction;
|
|
22
18
|
drag.direction = 0;
|
|
23
19
|
const scrollDirection = this.scroll(drag, time);
|
|
20
|
+
if (scrollDirection)
|
|
21
|
+
this.requestFrame();
|
|
22
|
+
if (drag.remove)
|
|
23
|
+
return;
|
|
24
24
|
const direction = pointerDirection || scrollDirection;
|
|
25
25
|
const target = direction ? this.target(drag, direction) : drag.index;
|
|
26
26
|
if (target !== drag.index)
|
|
27
27
|
this.move(drag, target);
|
|
28
|
-
if (scrollDirection)
|
|
29
|
-
this.requestFrame();
|
|
30
28
|
}
|
|
31
29
|
defaultOptions() {
|
|
32
30
|
return new TableColumnReorderOptions();
|
|
33
31
|
}
|
|
34
32
|
finish(commit) {
|
|
35
33
|
this.press = undefined;
|
|
36
|
-
if (this.frame !== undefined)
|
|
34
|
+
if (this.frame !== undefined) {
|
|
37
35
|
cancelAnimationFrame(this.frame);
|
|
36
|
+
}
|
|
38
37
|
this.frame = undefined;
|
|
39
38
|
const drag = this.drag;
|
|
40
39
|
if (!drag)
|
package/package.json
CHANGED