Skip to content

Commit

Permalink
sync dev
Browse files Browse the repository at this point in the history
  • Loading branch information
theniceangel committed Jan 26, 2021
2 parents eb74424 + 74f5178 commit ef9825a
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 77 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"packages": [
"packages/*"
],
"version": "2.1.1"
"version": "2.1.4"
}
28 changes: 14 additions & 14 deletions packages/better-scroll/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "better-scroll",
"version": "2.1.1",
"version": "2.1.4",
"description": "Full-featured BetterScroll",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -31,19 +31,19 @@
"directory": "packages/better-scroll"
},
"dependencies": {
"@better-scroll/core": "^2.1.1",
"@better-scroll/infinity": "^2.1.1",
"@better-scroll/mouse-wheel": "^2.1.1",
"@better-scroll/movable": "^2.1.1",
"@better-scroll/nested-scroll": "^2.1.1",
"@better-scroll/observe-dom": "^2.1.1",
"@better-scroll/observe-image": "^2.1.1",
"@better-scroll/pull-down": "^2.1.1",
"@better-scroll/pull-up": "^2.1.1",
"@better-scroll/scroll-bar": "^2.1.1",
"@better-scroll/slide": "^2.1.1",
"@better-scroll/wheel": "^2.1.1",
"@better-scroll/zoom": "^2.1.1"
"@better-scroll/core": "^2.1.4",
"@better-scroll/infinity": "^2.1.4",
"@better-scroll/mouse-wheel": "^2.1.4",
"@better-scroll/movable": "^2.1.4",
"@better-scroll/nested-scroll": "^2.1.4",
"@better-scroll/observe-dom": "^2.1.4",
"@better-scroll/observe-image": "^2.1.4",
"@better-scroll/pull-down": "^2.1.4",
"@better-scroll/pull-up": "^2.1.4",
"@better-scroll/scroll-bar": "^2.1.4",
"@better-scroll/slide": "^2.1.4",
"@better-scroll/wheel": "^2.1.4",
"@better-scroll/zoom": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/core",
"version": "2.1.1",
"version": "2.1.4",
"description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -31,7 +31,7 @@
"directory": "packages/core"
},
"dependencies": {
"@better-scroll/shared-utils": "^2.1.1"
"@better-scroll/shared-utils": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
2 changes: 1 addition & 1 deletion packages/examples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "examples",
"version": "2.1.1",
"version": "2.1.4",
"description": "Examples of BetterScroll",
"author": {
"name": "jizhi",
Expand Down
4 changes: 2 additions & 2 deletions packages/infinity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/infinity",
"version": "2.1.1",
"version": "2.1.4",
"description": "The ability to inject a infinity load for BetterScroll.",
"author": "fengweiyao <fengweiyao0317@hotmail.com>",
"main": "dist/infinity.min.js",
Expand All @@ -27,7 +27,7 @@
"directory": "packages/infinity"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
4 changes: 2 additions & 2 deletions packages/mouse-wheel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/mouse-wheel",
"version": "2.1.1",
"version": "2.1.4",
"description": "support for MouseWheel in PC",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -30,7 +30,7 @@
"directory": "packages/mouse-wheel"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
4 changes: 2 additions & 2 deletions packages/movable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/movable",
"version": "2.1.1",
"version": "2.1.4",
"description": "Movable plugin for BetterScroll",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -30,6 +30,6 @@
"directory": "packages/observe-dom"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
}
}
4 changes: 2 additions & 2 deletions packages/nested-scroll/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/nested-scroll",
"version": "2.1.1",
"version": "2.1.4",
"description": "make your nested scrolls reconciliation",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -31,7 +31,7 @@
"directory": "packages/nested-scroll"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
4 changes: 4 additions & 0 deletions packages/nested-scroll/src/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ describe('NestedScroll tests', () => {
hasVerticalScroll: false,
hasHorizontalScroll: true,
})
addProperties(grandsonScrollH, {
hasVerticalScroll: false,
hasHorizontalScroll: true,
})
grandsonScrollH.trigger(grandsonScrollH.eventTypes.beforeScrollStart)

expect(parentScrollH.disable).toBeCalled()
Expand Down
17 changes: 11 additions & 6 deletions packages/nested-scroll/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ const enableScrollHander = (scrolls: BScroll[]) => {
})
}

const disableScrollHander = (scrolls: BScroll[]) => {
const disableScrollHander = (scrolls: BScroll[], currentScroll: BScroll) => {
scrolls.forEach((scroll) => {
scroll.disable()
if (
scroll.hasHorizontalScroll === currentScroll.hasHorizontalScroll ||
scroll.hasVerticalScroll === currentScroll.hasVerticalScroll
) {
scroll.disable()
}
})
}

Expand Down Expand Up @@ -306,7 +311,7 @@ export default class NestedScroll implements PluginAPI {
resetPositionHandler(currentScroll)
}
syncTouchstartData(ancestorScrolls)
disableScrollHander(ancestorScrolls)
disableScrollHander(ancestorScrolls, currentScroll)
}

const touchEndHandler = () => {
Expand Down Expand Up @@ -343,14 +348,14 @@ export default class NestedScroll implements PluginAPI {
const contentMoved = currentScroll.scroller.actions.contentMoved
const isTopScroll = ancestorScrolls.length === 0
if (contentMoved) {
disableScrollHander(ancestorScrolls)
disableScrollHander(ancestorScrolls, currentScroll)
} else if (!isTopScroll) {
if (isOutOfBoundary(currentScroll)) {
disableScrollHander([currentScroll])
disableScrollHander([currentScroll], currentScroll)
if (parentScroll) {
enableScrollHander([parentScroll])
}
disableScrollHander(otherAncestorScrolls)
disableScrollHander(otherAncestorScrolls, currentScroll)
return true
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/observe-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/observe-dom",
"version": "2.1.1",
"version": "2.1.4",
"description": "Dynamic recalculating container's size for BetterScroll",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -30,7 +30,7 @@
"directory": "packages/observe-dom"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
4 changes: 2 additions & 2 deletions packages/observe-image/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/observe-image",
"version": "2.1.1",
"version": "2.1.4",
"description": "Observe image loading for BetterScroll",
"author": "theniceangel <theniceangel@163.com>",
"homepage": "https://github.com/ustbhuangyi/better-scroll/tree/master/packages/observe-image#readme",
Expand Down Expand Up @@ -28,6 +28,6 @@
"url": "https://github.com/ustbhuangyi/better-scroll/issues"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
}
}
4 changes: 2 additions & 2 deletions packages/pull-down/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/pull-down",
"version": "2.1.1",
"version": "2.1.4",
"description": "pull down to refresh, behave likes App list refreshing",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -31,7 +31,7 @@
"directory": "packages/pull-down"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
4 changes: 2 additions & 2 deletions packages/pull-up/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/pull-up",
"version": "2.1.1",
"version": "2.1.4",
"description": "pull up to load more data",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -30,7 +30,7 @@
"directory": "packages/pull-up"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
4 changes: 2 additions & 2 deletions packages/scroll-bar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@better-scroll/scroll-bar",
"version": "2.1.1",
"version": "2.1.4",
"description": "scrollbar is used to BetterScroll, which behaves like browser scrollbar",
"author": {
"name": "jizhi",
Expand Down Expand Up @@ -30,7 +30,7 @@
"directory": "packages/scroll-bar"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
8 changes: 4 additions & 4 deletions packages/shared-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@better-scroll/shared-utils",
"version": "2.1.1",
"version": "2.1.4",
"description": "shared-utils for BetterScroll",
"author": {
"name": "jizhi",
"email": "theniceangel@163.com"
},
"name": "jizhi",
"email": "theniceangel@163.com"
},
"main": "dist/shared-utils.min.js",
"module": "dist/shared-utils.esm.js",
"typings": "dist/types/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions packages/slide/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@better-scroll/slide",
"version": "2.1.1",
"version": "2.1.4",
"description": "a carousel effect triggered by BetterScroll",
"author": {
"name": "jizhi",
"email": "theniceangel@163.com"
},
"name": "jizhi",
"email": "theniceangel@163.com"
},
"main": "dist/slide.min.js",
"module": "dist/slide.esm.js",
"typings": "dist/types/index.d.ts",
Expand All @@ -30,7 +30,7 @@
"directory": "packages/slide"
},
"dependencies": {
"@better-scroll/core": "^2.1.1"
"@better-scroll/core": "^2.1.4"
},
"gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130"
}
20 changes: 11 additions & 9 deletions packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ In 2.0, BetterScroll events are almost same with 1.x events. Only BetterScroll w
```typescript
// bs version >= 2.0.4
bs.on('contentChanged', (newContent: HTMLElement) => {})
```
```

The following events must be registered for the **plugin** in parentheses to be dispatched:

Expand All @@ -331,13 +331,15 @@ The following events must be registered for the **plugin** in parentheses to be
bs.on('alterOptions', (mouseWheelOptions) => {
/**
* mouseWheelOptions.speed:鼠标滚轮滚动的速度
* mouseWheelOptions.invert:滚轮滚动和 BetterScroll 滚动的方向是否一致
* mouseWheelOptions.easeTime:滚动动画的缓动时长。
* mouseWheelOptions.discreteTime:触发 wheelEnd 的间隔时长
* mouseWheelOptions.throttleTime:滚轮滚动是高频率的动作,因此可以通过 throttleTime 来限制触发频率
* mouseWheelOptions.dampingFactor:阻尼因子,当超出边界会施加阻力
* mouseWheelOptions.speed
* mouseWheelOptions.invert
* mouseWheelOptions.easeTime
* mouseWheelOptions.discreteTime
* mouseWheelOptions.throttleTime
* mouseWheelOptions.dampingFactor
**/
// please see details in mouse-wheel plugin doc
})
```

Expand Down Expand Up @@ -522,7 +524,7 @@ A hook is a concept extended from version 2.0. Its essence is the same as an eve
const bs = new BScroll('.wrapper', {})
bs.hooks.on('destroy', () => { console.log('destroyed') })
```

- **contentChanged**<sup>(2.0.4)</sup>
- **Trigger timing**:When calling `bs.refresh()`, it is detected that the content DOM has become other elements
- **Usage**
Expand All @@ -532,7 +534,7 @@ A hook is a concept extended from version 2.0. Its essence is the same as an eve
// bs version >= 2.0.4
bs.hooks.on('contentChanged', (newContent: HTMLElement) => { console.log(newContent) })
```


- **ActionsHandler.hooks**

Expand Down
Loading

0 comments on commit ef9825a

Please sign in to comment.