Compare commits

...

4 Commits

Author SHA1 Message Date
neverland
600e0357f5
docs(changelog): vant@2.13.0 (#12294) 2023-09-17 19:45:38 +08:00
chenjiahan
3ec8d70bbf chore: release 2.13.0 2023-09-17 19:39:50 +08:00
lllomh
59e08cb912
fix(Picker): Fix the issue when scrolling the mouse wheel once but the element scrolls multiple times (#12290)
* fix(Picker): Fix the problem of scrolling an element multiple times with one mouse roll

* fix(Test Cases): Corresponding Adjustment Test Cases about  #12290
2023-09-17 19:39:06 +08:00
neverland
80fd5f6daa
chore: bump @vant/icons to v3 (#12293)
* chore: bump @vant/icons to v3

* chore: update lock

* chore: fix icon path
2023-09-17 19:38:21 +08:00
7 changed files with 90 additions and 25 deletions

View File

@ -16,6 +16,35 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
## Details
### [v2.13.0](https://github.com/vant-ui/vant/compare/v2.12.54...v2.13.0)
`2023-09-17`
**Feature**
- Icon: rename the previous `records` icon to `records-o`
- Icon: rename the previous `contact` icon to `contact-o`
- Icon: rename the previous `discount` icon to `discount-o`
- Icon: rename the previous `completed` icon to `completed-o`
- Icon: rename the previous `description` icon to `description-o`
- Icon: rename the previous `cash-back-record` icon to `cash-back-record-o`
- Icon: add a filled `records` icon
- Icon: add a filled `contact` icon
- Icon: add a filled `discount` icon
- Icon: add a filled `completed` icon
- Icon: add a filled `description` icon
- Icon: add a filled `cash-back-record` icon
- Icon: add new `user` icon
- Icon: add new `notes` icon
- Icon: add new `newspaper` icon
- Icon: add new `list-switch` icon
- Icon: add new `list-switching` icon
**Bug Fixes**
- Picker: Fix the issue when scrolling the mouse wheel once but the element scrolls multiple times [#12290](https://github.com/vant-ui/vant/issues/12290) [#12290](https://github.com/vant-ui/vant/issues/12290)
- Icon: fix delete / delete-o icon
### [v2.12.54](https://github.com/vant-ui/vant/compare/v2.12.53...v2.12.54)
`2023-02-11`

View File

@ -25,6 +25,35 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
## 更新内容
### [v2.13.0](https://github.com/vant-ui/vant/compare/v2.12.54...v2.13.0)
`2023-09-17`
**Feature**
- Icon: 重命名线框风格的 `records` 图标为 `records-o`
- Icon: 重命名线框风格的 `contact` 图标为 `contact-o`
- Icon: 重命名线框风格的 `discount` 图标为 `discount-o`
- Icon: 重命名线框风格的 `completed` 图标为 `completed-o`
- Icon: 重命名线框风格的 `description` 图标为 `description-o`
- Icon: 重命名线框风格的 `cash-back-record` 图标为 `cash-back-record-o`
- Icon: 新增实底风格的 `records` 图标
- Icon: 新增实底风格的 `contact` 图标
- Icon: 新增实底风格的 `discount` 图标
- Icon: 新增实底风格的 `completed` 图标
- Icon: 新增实底风格的 `description` 图标
- Icon: 新增实底风格的 `cash-back-record` 图标
- Icon: 新增 `user` 图标
- Icon: 新增 `notes` 图标
- Icon: 新增 `newspaper` 图标
- Icon: 新增 `list-switch` 图标
- Icon: 新增 `list-switching` 图标
**Bug Fixes**
- Picker: 修复滚轮操作时多次滚动的问题 [#12290](https://github.com/vant-ui/vant/issues/12290) [#12290](https://github.com/vant-ui/vant/issues/12290)
- Icon: 修复 delete / delete-o 图标
### [v2.12.54](https://github.com/vant-ui/vant/compare/v2.12.53...v2.12.54)
`2023-02-11`

View File

@ -1,6 +1,6 @@
{
"name": "vant",
"version": "2.12.54",
"version": "2.13.0",
"description": "Mobile UI Components built on Vue",
"main": "lib/index.js",
"module": "es/index.js",
@ -57,7 +57,7 @@
"license": "MIT",
"dependencies": {
"@babel/runtime": "7.x",
"@vant/icons": "^1.7.1",
"@vant/icons": "^3.0.0",
"@vant/popperjs": "^1.1.0",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"vue-lazyload": "1.2.3"

View File

@ -1 +1 @@
@import '~@vant/icons/src/encode.less';
@import '~@vant/icons/src/encode-woff2.less';

View File

@ -202,11 +202,10 @@ export default createComponent({
return;
}
// get offset
// if necessary, can adjust distance value to make scrolling smoother
const distance = -deltaY;
// Calculate the offset based on itemHeight
const itemOffset = this.itemHeight * (deltaY > 0 ? -1 : 1);
this.offset = range(
this.startOffset + distance,
this.startOffset + itemOffset,
-(this.count * this.itemHeight),
this.itemHeight
);

View File

@ -1,5 +1,8 @@
import Picker from '..';
import PickerColumn, { MOMENTUM_LIMIT_TIME, MOMENTUM_LIMIT_DISTANCE} from '../PickerColumn';
import PickerColumn, {
MOMENTUM_LIMIT_TIME,
MOMENTUM_LIMIT_DISTANCE,
} from '../PickerColumn';
import { mount, triggerDrag, later } from '../../../test';
import { DEFAULT_ITEM_HEIGHT } from '../shared';
@ -353,7 +356,7 @@ test('wheel event on columns is detected', async () => {
});
test('wheel scroll on columns', async () => {
const fakeScroll = (translateY, deltaY)=> {
const fakeScroll = (translateY, deltaY) => {
// mock getComputedStyle
// see: https://github.com/jsdom/jsdom/issues/2588
const originGetComputedStyle = window.getComputedStyle;
@ -364,7 +367,7 @@ test('wheel scroll on columns', async () => {
transform: `matrix(1, 0, 0, 1, 0, ${translateY})`,
};
};
return new Promise(resolve => {
return new Promise((resolve) => {
const wrapper = mount(Picker, {
propsData: {
columns: simpleColumn,
@ -375,14 +378,16 @@ test('wheel scroll on columns', async () => {
deltaY,
});
return later(MOMENTUM_LIMIT_TIME + 10).then(()=>{
wrapper.find('.van-picker-column ul').trigger('transitionend');
resolve(wrapper.emitted('change'));
}).finally(()=>{
window.getComputedStyle = originGetComputedStyle;
});
return later(MOMENTUM_LIMIT_TIME + 10)
.then(() => {
wrapper.find('.van-picker-column ul').trigger('transitionend');
resolve(wrapper.emitted('change'));
})
.finally(() => {
window.getComputedStyle = originGetComputedStyle;
});
});
}
};
const topToDown = await fakeScroll(110, -MOMENTUM_LIMIT_DISTANCE);
expect(topToDown).toEqual(undefined);
@ -394,9 +399,12 @@ test('wheel scroll on columns', async () => {
expect(bottomToUp[0][1]).toEqual('1995');
const bottomToDown = await fakeScroll(-110, -(MOMENTUM_LIMIT_DISTANCE - 5));
expect(bottomToDown[0][1]).toEqual('1995');
expect(bottomToDown[0][1]).toEqual('1994');
const pos1992 = simpleColumn.indexOf('1992')
const momentum = await fakeScroll(-110 + (pos1992 + 1) * DEFAULT_ITEM_HEIGHT, MOMENTUM_LIMIT_DISTANCE + 10);
expect(momentum[0][1]).toEqual(simpleColumn[pos1992+1]);
const pos1992 = simpleColumn.indexOf('1992');
const momentum = await fakeScroll(
-110 + (pos1992 + 1) * DEFAULT_ITEM_HEIGHT,
MOMENTUM_LIMIT_DISTANCE + 10
);
expect(momentum[0][1]).toEqual(simpleColumn[pos1992 + 1]);
});

View File

@ -1767,10 +1767,10 @@
eslint-plugin-import "^2.20.2"
eslint-plugin-vue "^6.2.2"
"@vant/icons@^1.7.1":
version "1.7.1"
resolved "https://registry.npmjs.org/@vant/icons/-/icons-1.7.1.tgz#49ae420302b5581e54e6894891e5a05bc76e9f87"
integrity sha512-66LPEq89w4kl258nALZcRNd14eUJC8VajvTJwvZKOaZawz6CUeVZ6ybhedTUhQhRjeA8SyWD7dFt4ALf33Sabw==
"@vant/icons@^3.0.0":
version "3.0.0"
resolved "https://registry.npmmirror.com/@vant/icons/-/icons-3.0.0.tgz#685bf941ccb7d9ddfa07dd4457188168be5311c4"
integrity sha512-g0sNQGwq3xajpri698ql/MjeMZ0Bwptjf7WO+s5fZEPq4smesmwC8Jda1OetidBjI0cQ5c7cYqoNGlkQA81TMw==
"@vant/markdown-loader@^2.5.0":
version "2.5.0"