jqtree 1.8.10 → 1.8.11
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/bower.json +3 -10
- package/eslint.config.mjs +27 -3
- package/package.json +50 -47
- package/src/elementsRenderer.ts +1 -1
- package/src/mouseHandler.ts +10 -7
- package/src/node.ts +1 -5
- package/src/nodeElement/index.ts +1 -3
- package/src/scrollHandler/containerScrollParent.ts +19 -118
- package/src/scrollHandler/createScrollParent.ts +1 -1
- package/src/scrollHandler/documentScrollParent.ts +35 -118
- package/src/scrollHandler/scrollParent.ts +117 -0
- package/src/scrollHandler.ts +5 -7
- package/src/simple.widget.ts +1 -3
- package/src/tree.jquery.ts +5 -13
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +202 -295
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +3 -3
- package/tree.jquery.js.map +1 -1
- package/.tool-versions +0 -2
- package/src/scrollHandler/types.ts +0 -7
package/bower.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jqTree",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"main": [
|
|
5
|
-
"jqtree.css",
|
|
6
|
-
"jqtree-circle.png",
|
|
7
|
-
"tree.jquery.js"
|
|
8
|
-
],
|
|
3
|
+
"version": "1.8.11",
|
|
4
|
+
"main": ["jqtree.css", "jqtree-circle.png", "tree.jquery.js"],
|
|
9
5
|
"dependencies": {
|
|
10
6
|
"jquery": ">=1.9"
|
|
11
7
|
},
|
|
12
8
|
"license": "Apache-2.0",
|
|
13
9
|
"ignore": [],
|
|
14
|
-
"keywords": [
|
|
15
|
-
"jquery-plugin",
|
|
16
|
-
"tree"
|
|
17
|
-
]
|
|
10
|
+
"keywords": ["jquery-plugin", "tree"]
|
|
18
11
|
}
|
package/eslint.config.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import cspellESLintPluginRecommended from "@cspell/eslint-plugin/recommended";
|
|
1
2
|
import eslint from "@eslint/js";
|
|
2
3
|
import tseslint from "typescript-eslint";
|
|
3
4
|
import importPlugin from "eslint-plugin-import";
|
|
4
|
-
import jestPlugin from "eslint-plugin-jest";
|
|
5
5
|
import jestDomPlugin from "eslint-plugin-jest-dom";
|
|
6
|
+
import jestExtendedPlugin from "eslint-plugin-jest-extended";
|
|
6
7
|
import perfectionistPlugin from "eslint-plugin-perfectionist";
|
|
7
8
|
import playwrightPlugin from "eslint-plugin-playwright";
|
|
8
9
|
import testingLibraryPlugin from "eslint-plugin-testing-library";
|
|
10
|
+
import vitestPlugin from "@vitest/eslint-plugin";
|
|
9
11
|
|
|
10
12
|
export default [
|
|
11
13
|
eslint.configs.recommended,
|
|
@@ -14,6 +16,7 @@ export default [
|
|
|
14
16
|
importPlugin.flatConfigs.recommended,
|
|
15
17
|
importPlugin.flatConfigs.typescript,
|
|
16
18
|
perfectionistPlugin.configs["recommended-natural"],
|
|
19
|
+
cspellESLintPluginRecommended,
|
|
17
20
|
{
|
|
18
21
|
languageOptions: {
|
|
19
22
|
parserOptions: {
|
|
@@ -24,6 +27,7 @@ export default [
|
|
|
24
27
|
rules: {
|
|
25
28
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
26
29
|
"@typescript-eslint/interface-name-prefix": "off",
|
|
30
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
27
31
|
"@typescript-eslint/no-explicit-any": "off",
|
|
28
32
|
"@typescript-eslint/no-use-before-define": "off",
|
|
29
33
|
"@typescript-eslint/no-unused-vars": [
|
|
@@ -47,16 +51,32 @@ export default [
|
|
|
47
51
|
},
|
|
48
52
|
],
|
|
49
53
|
"@typescript-eslint/unified-signatures": "off",
|
|
54
|
+
"@cspell/spellchecker": [
|
|
55
|
+
"error",
|
|
56
|
+
{
|
|
57
|
+
configFile: "./config/cspell.json",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
50
60
|
},
|
|
51
61
|
},
|
|
52
62
|
{
|
|
53
63
|
files: ["src/test/**/*.ts"],
|
|
54
|
-
...
|
|
64
|
+
...vitestPlugin.configs.all,
|
|
55
65
|
},
|
|
56
66
|
{
|
|
57
67
|
files: ["src/test/**/*.ts"],
|
|
58
68
|
rules: {
|
|
59
|
-
"
|
|
69
|
+
"vitest/no-duplicate-hooks": "off",
|
|
70
|
+
"vitest/no-hooks": "off",
|
|
71
|
+
"vitest/no-identical-title": "off",
|
|
72
|
+
"vitest/prefer-called-times": "off",
|
|
73
|
+
"vitest/prefer-describe-function-title": "off",
|
|
74
|
+
"vitest/prefer-expect-assertions": "off",
|
|
75
|
+
"vitest/prefer-importing-vitest-globals": "off",
|
|
76
|
+
"vitest/prefer-lowercase-title": "off",
|
|
77
|
+
"vitest/prefer-strict-boolean-matchers": "off",
|
|
78
|
+
"vitest/require-hook": "off",
|
|
79
|
+
"vitest/require-mock-type-parameters": "off",
|
|
60
80
|
},
|
|
61
81
|
},
|
|
62
82
|
{
|
|
@@ -67,6 +87,10 @@ export default [
|
|
|
67
87
|
files: ["src/test/**/*.ts"],
|
|
68
88
|
...jestDomPlugin.configs["flat/recommended"],
|
|
69
89
|
},
|
|
90
|
+
{
|
|
91
|
+
files: ["src/test/**/*.ts"],
|
|
92
|
+
...jestExtendedPlugin.configs["flat/all"],
|
|
93
|
+
},
|
|
70
94
|
{
|
|
71
95
|
files: ["src/playwright/**/*.ts"],
|
|
72
96
|
...playwrightPlugin.configs["flat/recommended"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jqtree",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.11",
|
|
4
4
|
"description": "Tree widget for jQuery",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jquery-plugin",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"ci": "pnpm lint && pnpm tsc && pnpm test",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"vitest": "vitest run --coverage --config config/vitest.config.ts",
|
|
20
|
+
"vitest-watch": "vitest --config config/vitest.config.ts",
|
|
21
21
|
"lint": "eslint src",
|
|
22
22
|
"production": "./config/production",
|
|
23
23
|
"devserver": "SERVE=true rollup --config config/rollup.config.mjs --watch",
|
|
@@ -26,61 +26,64 @@
|
|
|
26
26
|
"prettier": "prettier src/*.ts --write --tab-width 4",
|
|
27
27
|
"tsc": "tsc --noEmit --project tsconfig.json",
|
|
28
28
|
"playwright": "pnpm build-with-coverage && playwright test --config config/playwright.config.js",
|
|
29
|
-
"test": "pnpm
|
|
29
|
+
"test": "pnpm vitest && pnpm playwright"
|
|
30
30
|
},
|
|
31
|
-
"browserslist": [
|
|
32
|
-
"defaults"
|
|
33
|
-
],
|
|
34
31
|
"peerDependencies": {
|
|
35
|
-
"jquery": "
|
|
32
|
+
"jquery": ">= 3"
|
|
36
33
|
},
|
|
37
34
|
"devDependencies": {
|
|
38
|
-
"@babel/cli": "^7.
|
|
39
|
-
"@babel/core": "^7.
|
|
40
|
-
"@babel/preset-env": "^7.
|
|
41
|
-
"@babel/preset-typescript": "^7.
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
35
|
+
"@babel/cli": "^7.28.6",
|
|
36
|
+
"@babel/core": "^7.28.6",
|
|
37
|
+
"@babel/preset-env": "^7.28.6",
|
|
38
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
39
|
+
"@cspell/eslint-plugin": "^9.6.0",
|
|
40
|
+
"@eslint/js": "^9.39.2",
|
|
41
|
+
"@playwright/test": "^1.57.0",
|
|
42
|
+
"@rollup/plugin-babel": "^6.1.0",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
45
44
|
"@rollup/plugin-terser": "^0.4.4",
|
|
46
|
-
"@testing-library/dom": "^10.4.
|
|
47
|
-
"@testing-library/jest-dom": "^6.
|
|
48
|
-
"@testing-library/user-event": "^14.
|
|
45
|
+
"@testing-library/dom": "^10.4.1",
|
|
46
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
47
|
+
"@testing-library/user-event": "^14.6.1",
|
|
49
48
|
"@types/debug": "^4.1.12",
|
|
50
|
-
"@types/
|
|
51
|
-
"@types/
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"autoprefixer": "^10.4.
|
|
55
|
-
"
|
|
56
|
-
"babel-plugin-istanbul": "^7.0.
|
|
57
|
-
"eslint": "^9.
|
|
58
|
-
"eslint-plugin-import": "^2.
|
|
59
|
-
"eslint-plugin-jest": "^28.10.0",
|
|
49
|
+
"@types/jquery": "^3.5.33",
|
|
50
|
+
"@types/node": "^25.0.10",
|
|
51
|
+
"@vitest/coverage-istanbul": "^4.0.18",
|
|
52
|
+
"@vitest/eslint-plugin": "^1.6.6",
|
|
53
|
+
"autoprefixer": "^10.4.23",
|
|
54
|
+
"axe-core": "^4.11.1",
|
|
55
|
+
"babel-plugin-istanbul": "^7.0.1",
|
|
56
|
+
"eslint": "^9.39.2",
|
|
57
|
+
"eslint-plugin-import": "^2.32.0",
|
|
60
58
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
61
|
-
"eslint-plugin-
|
|
62
|
-
"eslint-plugin-
|
|
63
|
-
"eslint-plugin-
|
|
59
|
+
"eslint-plugin-jest-extended": "^3.0.1",
|
|
60
|
+
"eslint-plugin-perfectionist": "^5.4.0",
|
|
61
|
+
"eslint-plugin-playwright": "^2.5.0",
|
|
62
|
+
"eslint-plugin-testing-library": "^7.15.4",
|
|
64
63
|
"givens": "^1.3.9",
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"msw": "^2.7.0",
|
|
74
|
-
"postcss": "^8.4.49",
|
|
75
|
-
"postcss-cli": "^11.0.0",
|
|
76
|
-
"postcss-import": "^16.1.0",
|
|
64
|
+
"jest-extended": "^7.0.0",
|
|
65
|
+
"jsdom-testing-mocks": "^1.16.0",
|
|
66
|
+
"jsonfile": "^6.2.0",
|
|
67
|
+
"lodash": "^4.17.23",
|
|
68
|
+
"msw": "^2.12.7",
|
|
69
|
+
"postcss": "^8.5.6",
|
|
70
|
+
"postcss-cli": "^11.0.1",
|
|
71
|
+
"postcss-import": "^16.1.1",
|
|
77
72
|
"postcss-load-config": "^6.0.1",
|
|
78
73
|
"postcss-nested": "^7.0.2",
|
|
79
|
-
"prettier": "^3.
|
|
80
|
-
"rollup": "^4.
|
|
74
|
+
"prettier": "^3.8.1",
|
|
75
|
+
"rollup": "^4.56.0",
|
|
81
76
|
"rollup-plugin-serve": "^3.0.0",
|
|
82
77
|
"tslib": "^2.8.1",
|
|
83
|
-
"typescript": "^5.
|
|
84
|
-
"typescript-eslint": "^8.
|
|
78
|
+
"typescript": "^5.9.3",
|
|
79
|
+
"typescript-eslint": "^8.53.1",
|
|
80
|
+
"vitest": "^4.0.18"
|
|
81
|
+
},
|
|
82
|
+
"pnpm": {
|
|
83
|
+
"onlyBuiltDependencies": [
|
|
84
|
+
"esbuild",
|
|
85
|
+
"msw",
|
|
86
|
+
"unrs-resolver"
|
|
87
|
+
]
|
|
85
88
|
}
|
|
86
89
|
}
|
package/src/elementsRenderer.ts
CHANGED
|
@@ -198,7 +198,7 @@ export default class ElementsRenderer {
|
|
|
198
198
|
* Call onCreateLi
|
|
199
199
|
*/
|
|
200
200
|
private createLi(node: Node, level: number): HTMLLIElement {
|
|
201
|
-
const isSelected =
|
|
201
|
+
const isSelected = this.isNodeSelected(node);
|
|
202
202
|
|
|
203
203
|
const mustShowFolder =
|
|
204
204
|
node.isFolder() || (node.isEmptyFolder && this.showEmptyFolder);
|
package/src/mouseHandler.ts
CHANGED
|
@@ -6,22 +6,25 @@ import {
|
|
|
6
6
|
} from "./mouseUtils";
|
|
7
7
|
import { Node } from "./node";
|
|
8
8
|
|
|
9
|
+
export type GetMouseDelay = () => number;
|
|
10
|
+
export type GetNode = (element: HTMLElement) => Node | null;
|
|
11
|
+
export type MouseCapture = (positionInfo: PositionInfo) => boolean | null;
|
|
12
|
+
export type MouseStart = (positionInfo: PositionInfo) => boolean;
|
|
13
|
+
|
|
9
14
|
interface ClickTarget {
|
|
10
15
|
node: Node;
|
|
11
16
|
type: "button" | "label";
|
|
12
17
|
}
|
|
13
18
|
|
|
14
|
-
type GetNode = (element: HTMLElement) => Node | null;
|
|
15
|
-
|
|
16
19
|
interface MouseHandlerParams {
|
|
17
20
|
element: HTMLElement;
|
|
18
21
|
getMouseDelay: () => number;
|
|
19
22
|
getNode: GetNode;
|
|
20
23
|
onClickButton: (node: Node) => void;
|
|
21
24
|
onClickTitle: (node: Node) => void;
|
|
22
|
-
onMouseCapture:
|
|
25
|
+
onMouseCapture: MouseCapture;
|
|
23
26
|
onMouseDrag: (positionInfo: PositionInfo) => void;
|
|
24
|
-
onMouseStart:
|
|
27
|
+
onMouseStart: MouseStart;
|
|
25
28
|
onMouseStop: (positionInfo: PositionInfo) => void;
|
|
26
29
|
triggerEvent: TriggerEvent;
|
|
27
30
|
useContextMenu: boolean;
|
|
@@ -29,7 +32,7 @@ interface MouseHandlerParams {
|
|
|
29
32
|
|
|
30
33
|
class MouseHandler {
|
|
31
34
|
private element: HTMLElement;
|
|
32
|
-
private getMouseDelay:
|
|
35
|
+
private getMouseDelay: GetMouseDelay;
|
|
33
36
|
private getNode: GetNode;
|
|
34
37
|
|
|
35
38
|
private isMouseDelayMet: boolean;
|
|
@@ -42,11 +45,11 @@ class MouseHandler {
|
|
|
42
45
|
private onClickButton: (node: Node) => void;
|
|
43
46
|
private onClickTitle: (node: Node) => void;
|
|
44
47
|
|
|
45
|
-
private onMouseCapture:
|
|
48
|
+
private onMouseCapture: MouseCapture;
|
|
46
49
|
|
|
47
50
|
private onMouseDrag: (positionInfo: PositionInfo) => void;
|
|
48
51
|
|
|
49
|
-
private onMouseStart:
|
|
52
|
+
private onMouseStart: MouseStart;
|
|
50
53
|
|
|
51
54
|
private onMouseStop: (positionInfo: PositionInfo) => void;
|
|
52
55
|
|
package/src/node.ts
CHANGED
|
@@ -202,11 +202,7 @@ export class Node implements INode {
|
|
|
202
202
|
if (!this.hasChildren()) {
|
|
203
203
|
return null;
|
|
204
204
|
} else {
|
|
205
|
-
const lastChild = this.children[this.children.length - 1];
|
|
206
|
-
|
|
207
|
-
if (!lastChild) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
205
|
+
const lastChild = this.children[this.children.length - 1] as Node;
|
|
210
206
|
|
|
211
207
|
if (!(lastChild.hasChildren() && lastChild.is_open)) {
|
|
212
208
|
return lastChild;
|
package/src/nodeElement/index.ts
CHANGED
|
@@ -1,92 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type VerticalScrollDirection = "bottom" | "top";
|
|
12
|
-
|
|
13
|
-
export default class ContainerScrollParent implements ScrollParent {
|
|
14
|
-
private container: HTMLElement;
|
|
15
|
-
private horizontalScrollDirection?: HorizontalScrollDirection;
|
|
16
|
-
private horizontalScrollTimeout?: number;
|
|
17
|
-
private refreshHitAreas: () => void;
|
|
1
|
+
import { getElementPosition, getOffsetTop } from "../util";
|
|
2
|
+
import {
|
|
3
|
+
HorizontalScrollDirection,
|
|
4
|
+
ScrollParent,
|
|
5
|
+
VerticalScrollDirection,
|
|
6
|
+
} from "./scrollParent";
|
|
7
|
+
|
|
8
|
+
export default class ContainerScrollParent extends ScrollParent {
|
|
18
9
|
private scrollParentBottom?: number;
|
|
19
10
|
private scrollParentTop?: number;
|
|
20
|
-
private verticalScrollDirection?: VerticalScrollDirection;
|
|
21
|
-
private verticalScrollTimeout?: number;
|
|
22
|
-
|
|
23
|
-
constructor({ container, refreshHitAreas }: Params) {
|
|
24
|
-
this.container = container;
|
|
25
|
-
this.refreshHitAreas = refreshHitAreas;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public checkHorizontalScrolling(pageX: number): void {
|
|
29
|
-
const newHorizontalScrollDirection =
|
|
30
|
-
this.getNewHorizontalScrollDirection(pageX);
|
|
31
|
-
|
|
32
|
-
if (this.horizontalScrollDirection !== newHorizontalScrollDirection) {
|
|
33
|
-
this.horizontalScrollDirection = newHorizontalScrollDirection;
|
|
34
|
-
|
|
35
|
-
if (this.horizontalScrollTimeout != null) {
|
|
36
|
-
window.clearTimeout(this.verticalScrollTimeout);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (newHorizontalScrollDirection) {
|
|
40
|
-
this.horizontalScrollTimeout = window.setTimeout(
|
|
41
|
-
this.scrollHorizontally.bind(this),
|
|
42
|
-
40,
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public checkVerticalScrolling(pageY: number) {
|
|
49
|
-
const newVerticalScrollDirection =
|
|
50
|
-
this.getNewVerticalScrollDirection(pageY);
|
|
51
|
-
|
|
52
|
-
if (this.verticalScrollDirection !== newVerticalScrollDirection) {
|
|
53
|
-
this.verticalScrollDirection = newVerticalScrollDirection;
|
|
54
|
-
|
|
55
|
-
if (this.verticalScrollTimeout != null) {
|
|
56
|
-
window.clearTimeout(this.verticalScrollTimeout);
|
|
57
|
-
this.verticalScrollTimeout = undefined;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (newVerticalScrollDirection) {
|
|
61
|
-
this.verticalScrollTimeout = window.setTimeout(
|
|
62
|
-
this.scrollVertically.bind(this),
|
|
63
|
-
40,
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public getScrollLeft(): number {
|
|
70
|
-
return this.container.scrollLeft;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public scrollToY(top: number): void {
|
|
74
|
-
this.container.scrollTop = top;
|
|
75
|
-
}
|
|
76
11
|
|
|
77
12
|
public stopScrolling() {
|
|
13
|
+
super.stopScrolling();
|
|
14
|
+
|
|
78
15
|
this.horizontalScrollDirection = undefined;
|
|
79
16
|
this.verticalScrollDirection = undefined;
|
|
80
|
-
this.scrollParentTop = undefined;
|
|
81
|
-
this.scrollParentBottom = undefined;
|
|
82
17
|
}
|
|
83
18
|
|
|
84
|
-
|
|
19
|
+
protected getNewHorizontalScrollDirection(
|
|
85
20
|
pageX: number,
|
|
86
21
|
): HorizontalScrollDirection | undefined {
|
|
87
22
|
const scrollParentOffset = getElementPosition(this.container);
|
|
23
|
+
const containerWidth = this.container.getBoundingClientRect().width;
|
|
88
24
|
|
|
89
|
-
const rightEdge = scrollParentOffset.left +
|
|
25
|
+
const rightEdge = scrollParentOffset.left + containerWidth;
|
|
90
26
|
const leftEdge = scrollParentOffset.left;
|
|
91
27
|
const isNearRightEdge = pageX > rightEdge - 20;
|
|
92
28
|
const isNearLeftEdge = pageX < leftEdge + 20;
|
|
@@ -100,7 +36,7 @@ export default class ContainerScrollParent implements ScrollParent {
|
|
|
100
36
|
return undefined;
|
|
101
37
|
}
|
|
102
38
|
|
|
103
|
-
|
|
39
|
+
protected getNewVerticalScrollDirection(
|
|
104
40
|
pageY: number,
|
|
105
41
|
): undefined | VerticalScrollDirection {
|
|
106
42
|
if (pageY < this.getScrollParentTop()) {
|
|
@@ -116,53 +52,18 @@ export default class ContainerScrollParent implements ScrollParent {
|
|
|
116
52
|
|
|
117
53
|
private getScrollParentBottom() {
|
|
118
54
|
if (this.scrollParentBottom == null) {
|
|
119
|
-
|
|
55
|
+
const containerHeight =
|
|
56
|
+
this.container.getBoundingClientRect().height;
|
|
57
|
+
this.scrollParentBottom =
|
|
58
|
+
this.getScrollParentTop() + containerHeight;
|
|
120
59
|
}
|
|
121
60
|
|
|
122
61
|
return this.scrollParentBottom;
|
|
123
62
|
}
|
|
124
63
|
|
|
125
64
|
private getScrollParentTop() {
|
|
126
|
-
|
|
127
|
-
this.scrollParentTop = getOffsetTop(this.container)
|
|
128
|
-
}
|
|
65
|
+
this.scrollParentTop ??= getOffsetTop(this.container);
|
|
129
66
|
|
|
130
67
|
return this.scrollParentTop;
|
|
131
68
|
}
|
|
132
|
-
|
|
133
|
-
private scrollHorizontally() {
|
|
134
|
-
if (!this.horizontalScrollDirection) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const distance = this.horizontalScrollDirection === "left" ? -20 : 20;
|
|
139
|
-
|
|
140
|
-
this.container.scrollBy({
|
|
141
|
-
behavior: "instant",
|
|
142
|
-
left: distance,
|
|
143
|
-
top: 0,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
this.refreshHitAreas();
|
|
147
|
-
|
|
148
|
-
setTimeout(this.scrollHorizontally.bind(this), 40);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
private scrollVertically() {
|
|
152
|
-
if (!this.verticalScrollDirection) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const distance = this.verticalScrollDirection === "top" ? -20 : 20;
|
|
157
|
-
|
|
158
|
-
this.container.scrollBy({
|
|
159
|
-
behavior: "instant",
|
|
160
|
-
left: 0,
|
|
161
|
-
top: distance,
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
this.refreshHitAreas();
|
|
165
|
-
|
|
166
|
-
setTimeout(this.scrollVertically.bind(this), 40);
|
|
167
|
-
}
|
|
168
69
|
}
|