Skip to content

Commit 2af26e6

Browse files
committed
- add enableScrolling option for enabling scrolling which by default is true
- upgrade dependencies - bump version
1 parent 95007c9 commit 2af26e6

File tree

9 files changed

+1120
-1218
lines changed

9 files changed

+1120
-1218
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Logs
22

3+
## v0.6.6
4+
5+
- add `enableScrolling` option for enabling scrolling which by default is true
6+
- upgrade dependencies
7+
8+
39
## v0.6.5
410

511
- tweak scroll controller speed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ initialize:
5050
- apply on range
5151
- `scrollLock`: default true. prevent from horizontal scrolling of document.body if true.
5252
- this affects how user interact with sheet with scrolling gestures. check src comment for more information.
53+
- see also `enableScrolling`
54+
- `enableScrolling`: default true. enable scrolling if true.
55+
- the difference between `scrollLock` and `enableScrolling` is that:
56+
- `scrollLock` is for horizontal scrolling that may conflict with browser gesture.
57+
- `enableScrolling` is for mouse / trackpad scrolling behavior
5358
- `data`: initial data, as array of arrays
5459
- `slider`: default false. show slider widgets if true.
5560
- `cellcfg(opt)`: custom cell definition function. return value based on the given `opt`, which contains:

dist/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@
557557
return document.addEventListener('wheel', function(e){
558558
var inscope, spos, ref$, dx, dy, ox, oy;
559559
inscope = this$.eventInScope(e);
560+
if (this$.opt.enableScrolling != null && !this$.opt.enableScrolling) {
561+
return;
562+
}
560563
if (!(this$.opt.scrollLock != null) || this$.opt.scrollLock) {
561564
if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) {
562565
if (inscope || e.target === document.body) {

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1089 additions & 1205 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "@plotdb/sheet",
44
"license": "MIT",
55
"description": "spreadsheet",
6-
"version": "0.6.5",
6+
"version": "0.6.6",
77
"style": "dist/index.min.css",
88
"browser": "dist/index.min.js",
99
"main": "dist/index.min.js",
@@ -24,23 +24,23 @@
2424
"deploy": "npx deploy web/static"
2525
},
2626
"devDependencies": {
27-
"@loadingio/bootstrap.ext": "^0.0.9",
27+
"@loadingio/bootstrap.ext": "^0.0.11",
2828
"@loadingio/debounce.js": "1.0.1",
29-
"@loadingio/ldquery": "^3.0.4",
30-
"@plotdb/csscope": "^5.0.2",
29+
"@loadingio/ldquery": "^3.0.5",
30+
"@plotdb/csscope": "^5.0.3",
3131
"@plotdb/datadom": "^0.2.0",
3232
"@plotdb/json0": "^0.0.5",
33-
"@plotdb/rescope": "^5.0.3",
33+
"@plotdb/rescope": "^5.0.11",
3434
"@zbryikt/template": "^2.3.45",
3535
"body-parser": "^1.19.0",
3636
"bootstrap": "^4.5.2",
3737
"bootstrap.native": "^3.0.13",
3838
"dompurify": "^2.2.6",
39-
"fedep": "^1.1.7",
39+
"fedep": "^1.1.11",
4040
"jsoneditor": "^9.1.1",
41-
"ldcover": "^3.3.0",
42-
"ldiconfont": "^0.2.3",
43-
"ldview": "^1.3.2",
41+
"ldcover": "^3.5.3",
42+
"ldiconfont": "^0.2.6",
43+
"ldview": "^1.4.0",
4444
"livescript": "^1.6.0",
4545
"papaparse": "^5.4.1",
4646
"proxise": "^1.0.1",

src/index.ls

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,14 @@ sheet.prototype = Object.create(Object.prototype) <<< do
267267
# - container with overflow: hidden, or container which has scrolled to the leftmost position.
268268
# - in limited region while the gesture has been activated once in other unlimited regions
269269
# - this is true even if user reload the page after acitvated the gesture. wtf!
270-
# there can be prevented by calling preventDefault over every wheel event, but it may cause issues in:
270+
# this can be prevented by calling preventDefault over every wheel event, but it may cause issues in:
271271
# - other scrollable
272272
# - outside sheet area
273273
# for now we only find a way to make it okay:
274-
# - always preventDefault for horizontal scrolling if document.body is the target.
274+
# - always preventDefault for horizontal scrolling if document.body is the target.
275275
# this may affect the host document so we make it configurable by user, and by default enabled.
276276
inscope = @event-in-scope(e)
277+
if @opt.enable-scrolling? and !@opt.enable-scrolling => return
277278
if (!(@opt.scroll-lock?) or @opt.scroll-lock) => # if scroll-lock is enabled
278279
if Math.abs(e.deltaX) > Math.abs(e.deltaY) => # and it's horizontal scrolling
279280
if inscope or e.target == document.body => # and is in interested region

web/static/assets/lib/@plotdb/sheet/dev/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@
557557
return document.addEventListener('wheel', function(e){
558558
var inscope, spos, ref$, dx, dy, ox, oy;
559559
inscope = this$.eventInScope(e);
560+
if (this$.opt.enableScrolling != null && !this$.opt.enableScrolling) {
561+
return;
562+
}
560563
if (!(this$.opt.scrollLock != null) || this$.opt.scrollLock) {
561564
if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) {
562565
if (inscope || e.target === document.body) {

web/static/assets/lib/@plotdb/sheet/dev/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)