From 7f81066530bb0b6d482aa8c19b8c6952c201c7ce Mon Sep 17 00:00:00 2001 From: ZOYBAD14xx <60214442+ZOYBAD14xx@users.noreply.github.com> Date: Tue, 15 Mar 2022 10:13:22 +0700 Subject: [PATCH 01/10] feat(Locale): add la-LA.ts (#10388) --- packages/vant/src/locale/lang/la-LA.ts | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 packages/vant/src/locale/lang/la-LA.ts diff --git a/packages/vant/src/locale/lang/la-LA.ts b/packages/vant/src/locale/lang/la-LA.ts new file mode 100644 index 000000000..a6b3c97f6 --- /dev/null +++ b/packages/vant/src/locale/lang/la-LA.ts @@ -0,0 +1,64 @@ +export default { + name: 'ຊື່', + tel: 'ໂທລະສັບ', + save: 'ບັນທຶກ', + confirm: 'ຢຶນຢັນ', + cancel: 'ຍົກເລີກ', + delete: 'ລືບ', + loading: 'ກຳລັງໂຫຼດ...', + noCoupon: 'ບໍ່ມີຄູປອງ', + nameEmpty: 'ກະລຸນາປ້ອນຊື່', + addContact: 'ເພີ່ມຜູ້ຕິດຕໍ່', + telInvalid: 'ເບີໂທລະສັບບໍ່ຖືກຕ້ອງ', + vanCalendar: { + end: 'ຈົບ', + start: 'ເລີ່ມ', + title: 'ການເລືອກວັນທີ່', + weekdays: ['ອາ', 'ຈ', 'ອ', 'ພ', 'ພຫ', 'ສ', 'ສ'], + monthTitle: (year: number, month: number) => `${year}ປີ${month}ເດືອນ`, + rangePrompt: (maxRange: number) => + `ຈຳນອນວັນທີ່ເລືອກຕ້ອງບໍ່ເກີນ ${maxRange} ວັນ`, + }, + vanCascader: { + select: 'ກະລຸນາເລືອກ', + }, + vanPagination: { + prev: 'ໜ້າທີ່ແລ້ວ', + next: 'ໜ້າຕໍ່ໄປ', + }, + vanPullRefresh: { + pulling: 'ດືງລົງເພື່ອຣີເຟສ...', + loosing: 'ປ່ອຍເພື່ອຣີເຟສ...', + }, + vanSubmitBar: { + label: 'ລວມ:', + }, + vanCoupon: { + unlimited: 'ບໍ່ ຈຳກັດ', + discount: (discount: number) => `ລົດ${discount}`, + condition: (condition: number) => `ມີຈຳໜ່າຍໃນລາຄາ ${condition} ກວ່າຫຍວນ`, + }, + vanCouponCell: { + title: 'ຄູປອງ', + count: (count: number) => `ມີຮູບພາບ ${count} ຮູບ`, + }, + vanCouponList: { + exchange: 'ແລກປ່ຽນ', + close: 'ບໍ່ໄດ້ໃຊ້', + enable: 'ພ້ອມໃຊ້ງານ', + disabled: 'ບໍ່ພ້ອມໃຊ້ງານ', + placeholder: 'ກະລຸນາປ້ອນຄູປອງ', + }, + vanAddressEdit: { + area: 'ພື້ນທີ່', + postal: 'ລະຫັດໄປສະນີ', + areaEmpty: 'ກະລຸນາເລືອກພື້ນທີ່', + addressEmpty: 'ກະລຸນາປ້ອນທີ່ຢູ່', + postalEmpty: 'ກະລຸນາປ້ອນລະຫັດໄປສະນີ', + addressDetail: 'ທີ່ຢູ່', + defaultAddress: 'ຕັ້ງເປັນທີ່ຢູ່ເລີ່ມຕົ້ນ', + }, + vanAddressList: { + add: 'ເພີ່ມທີ່ຢູ່', + }, +}; From 1868c7586d9e846cf64b251d52a838554ed4a0a4 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 15 Mar 2022 11:18:52 +0800 Subject: [PATCH 02/10] docs(Locale): add Lao to document (#10389) --- packages/vant/src/locale/README.md | 1 + packages/vant/src/locale/README.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/vant/src/locale/README.md b/packages/vant/src/locale/README.md index c4ff8a9fd..c3d8cc8bb 100644 --- a/packages/vant/src/locale/README.md +++ b/packages/vant/src/locale/README.md @@ -52,6 +52,7 @@ Current supported languages: | Italian | it-IT | `v3.4.5` | | Japanese | ja-JP | - | | Korean | ko-KR | `v3.4.3` | +| Lao | la-LA | `v3.4.7` | | Norwegian | nb-NO | - | | Portuguese (Brazil) | pt-BR | `v3.3.3` | | Romanian | ro-RO | - | diff --git a/packages/vant/src/locale/README.zh-CN.md b/packages/vant/src/locale/README.zh-CN.md index a73634c1a..29db1db15 100644 --- a/packages/vant/src/locale/README.zh-CN.md +++ b/packages/vant/src/locale/README.zh-CN.md @@ -53,6 +53,7 @@ Locale.add(messages); | 意大利语 | it-IT | `v3.4.5` | | 日语 | ja-JP | - | | 韩语/朝鲜语 | ko-KR | `v3.4.3` | +| 老挝语 | la-LA | `v3.4.7` | | 挪威语 | nb-NO | - | | 葡萄牙语(巴西) | pt-BR | `v3.3.3` | | 罗马尼亚语 | ro-RO | - | From 15b413c9c3a37e84190ee9f52e7e027994afa602 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 17 Mar 2022 00:26:06 +0800 Subject: [PATCH 03/10] docs: add Select component faq (#10397) --- packages/vant/docs/markdown/faq.zh-CN.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/vant/docs/markdown/faq.zh-CN.md b/packages/vant/docs/markdown/faq.zh-CN.md index 7564b0cf9..21bca55bb 100644 --- a/packages/vant/docs/markdown/faq.zh-CN.md +++ b/packages/vant/docs/markdown/faq.zh-CN.md @@ -62,6 +62,12 @@ Vant 基于 CSS 变量提供了主题定制的能力,可以对组件样式进 参考链接:[stackoverflow - :active pseudo-class doesn't work in mobile safari](https://stackoverflow.com/questions/3885018/active-pseudo-class-doesnt-work-in-mobile-safari/33681490#33681490) +### 为什么没有 Select 组件? + +Select 是桌面端常用的组件,但它的交互形式不适合移动端。 + +在移动端,我们推荐使用 [Picker 选择器组件](#/zh-CN/picker) 作为代替。 + ### 部分组件无法在桌面端进行操作? 参见[桌面端适配](#/zh-CN/advanced-usage#zhuo-mian-duan-gua-pei)。 From ad78376278e31e697db3a454be90b90295ea313f Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 17 Mar 2022 00:32:50 +0800 Subject: [PATCH 04/10] docs: add dark mode to features (#10398) --- README.md | 3 ++- README.zh-CN.md | 3 ++- packages/vant/docs/markdown/home.en-US.md | 3 ++- packages/vant/docs/markdown/home.zh-CN.md | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b34356e1b..a1ddcc304 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ - 🍭 Support Tree Shaking - 🍭 Support Custom Theme - 🍭 Support Accessibility (still improving) +- 🍭 Support Dark Mode (Requires upgrade to [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/en-US/config-provider)) - 🍭 Support i18n - 🌍 Support SSR @@ -79,7 +80,7 @@ See more in [Quickstart](https://youzan.github.io/vant#/en-US/quickstart). Vant 2 supports modern browsers and Android >= 4.0、iOS >= 8.0. -Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3). +Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3). ## Official Ecosystem diff --git a/README.zh-CN.md b/README.zh-CN.md index f233139b7..3ee9bef92 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -41,6 +41,7 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源 - 🍭 支持主题定制,内置 700+ 个主题变量 - 🍭 支持按需引入和 Tree Shaking - 🍭 支持无障碍访问(持续改进中) +- 🍭 支持深色模式(需要升级至 [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/zh-CN/config-provider)) - 🍭 支持服务器端渲染 - 🌍 支持国际化和语言包定制 @@ -83,7 +84,7 @@ vant 也支持按需引入、CDN 引入等方式,详细说明见 [快速上手 Vant 2 支持现代浏览器以及 Android >= 4.0、iOS >= 8.0。 -Vant 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致)。 +Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致)。 ## 官方生态 diff --git a/packages/vant/docs/markdown/home.en-US.md b/packages/vant/docs/markdown/home.en-US.md index 9ed7a078f..26701e9f1 100644 --- a/packages/vant/docs/markdown/home.en-US.md +++ b/packages/vant/docs/markdown/home.en-US.md @@ -18,6 +18,7 @@ - 🍭 Support Tree Shaking - 🍭 Support Custom Theme - 🍭 Support Accessibility (still improving) +- 🍭 Support Dark Mode (Requires upgrade to [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/en-US/config-provider)) - 🍭 Support i18n - 🌍 Support SSR @@ -29,7 +30,7 @@ See in [Quickstart](#/en-US/quickstart). Vant 2 supports modern browsers and Android >= 4.0、iOS >= 8.0. -Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3). +Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3). ## Links diff --git a/packages/vant/docs/markdown/home.zh-CN.md b/packages/vant/docs/markdown/home.zh-CN.md index 9a89cdae4..7e072b97b 100644 --- a/packages/vant/docs/markdown/home.zh-CN.md +++ b/packages/vant/docs/markdown/home.zh-CN.md @@ -28,6 +28,7 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源 - 🍭 支持主题定制,内置 700+ 个主题变量 - 🍭 支持按需引入和 Tree Shaking - 🍭 支持无障碍访问(持续改进中) +- 🍭 支持深色模式(需要升级至 [Vant 4](https://vant-contrib.gitee.io/vant/v4/#/zh-CN/config-provider)) - 🍭 支持服务器端渲染 - 🌍 支持国际化和语言包定制 @@ -39,7 +40,7 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源 Vant 2 支持现代浏览器以及 Android >= 4.0、iOS >= 8.0。 -Vant 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致)。 +Vant 3/4 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致)。 ## 链接 From 6162b9f927846070850ed6f05855df57dfacfae7 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 17 Mar 2022 00:37:57 +0800 Subject: [PATCH 05/10] docs(DatetimePicker): add select second faq (#10399) --- packages/vant/src/datetime-picker/README.zh-CN.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/datetime-picker/README.zh-CN.md b/packages/vant/src/datetime-picker/README.zh-CN.md index fee998c13..2c2a72579 100644 --- a/packages/vant/src/datetime-picker/README.zh-CN.md +++ b/packages/vant/src/datetime-picker/README.zh-CN.md @@ -395,4 +395,12 @@ datetimePickerRef.value?.getPicker(); ### 是否有年份或月份选择器? -如果仅需要选择年份或者月份,建议直接使用 [Picker](#/zh-CN/picker) 组件。 +如果仅需要选择年份或者月份,建议直接使用 [Picker 选择器](#/zh-CN/picker) 组件。 + +你也可以升级到 Vant 4,并使用 [DatePicker 日期选择](https://vant-contrib.gitee.io/vant/v4/#/zh-CN/date-picker) 组件。 + +### 是否支持选择秒? + +Vant 3 中的 DatetimePicker 组件不支持选择秒。 + +请升级到 Vant 4,并使用 [TimePicker 时间选择](https://vant-contrib.gitee.io/vant/v4/#/zh-CN/time-picker) 组件。 From 5f67b9ee429c6c3e6aab8dc3c920b5b297df7467 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 17 Mar 2022 00:44:29 +0800 Subject: [PATCH 06/10] docs: add area data update tips (#10400) --- packages/vant-area-data/README.md | 6 +++++- packages/vant/src/area/README.md | 2 +- packages/vant/src/area/README.zh-CN.md | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/vant-area-data/README.md b/packages/vant-area-data/README.md index 74093e1ec..60e57bdf7 100644 --- a/packages/vant-area-data/README.md +++ b/packages/vant-area-data/README.md @@ -1,6 +1,6 @@ # Vant Area Data -省市区数据,适用于 Vant Area 组件。 +中国省市区数据,适用于 Vant Area 组件。 ## 安装 @@ -20,3 +20,7 @@ pnpm add @vant/area-data ```ts import { areaList } from '@vant/area-data'; ``` + +## 数据更新 + +中国的行政区划每年都会有变动,如果发现省市区数据未及时更新,欢迎提 Pull Request 帮助我们更新。 diff --git a/packages/vant/src/area/README.md b/packages/vant/src/area/README.md index 014a1b11a..fe91aa610 100644 --- a/packages/vant/src/area/README.md +++ b/packages/vant/src/area/README.md @@ -52,7 +52,7 @@ export default { ### @vant/area-data -Vant officially provides a default area data, which can be imported through [@vant/area-data](https://github.com/youzan/vant/tree/dev/packages/vant-area-data): +Vant officially provides a default China area data, which can be imported through [@vant/area-data](https://github.com/youzan/vant/tree/dev/packages/vant-area-data): ```bash # with npm diff --git a/packages/vant/src/area/README.zh-CN.md b/packages/vant/src/area/README.zh-CN.md index cc9bc0edc..12ce37be4 100644 --- a/packages/vant/src/area/README.zh-CN.md +++ b/packages/vant/src/area/README.zh-CN.md @@ -54,7 +54,7 @@ const areaList = { ### @vant/area-data -Vant 官方提供了一份默认的省市区数据,可以通过 [@vant/area-data](https://github.com/youzan/vant/tree/dev/packages/vant-area-data) 引入: +Vant 官方提供了一份默认的中国省市区数据,可以通过 [@vant/area-data](https://github.com/youzan/vant/tree/dev/packages/vant-area-data) 引入: ```bash # 通过 npm @@ -77,6 +77,8 @@ export default { }; ``` +> Tips: 中国的行政区划每年都会有变动,如果发现省市区数据未及时更新,欢迎提 Pull Request 帮助我们更新。 + ### 选中省市区 如果想选中某个省市区,需要传入一个 `value` 属性,绑定对应的地区码。 From 7c00cea86260888ae65f19ac6fd653500a82f145 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Fri, 18 Mar 2022 08:30:22 +0800 Subject: [PATCH 07/10] fix(IndexBar): allow active bottom anchor (#10404) * fix(IndexBar): allow active bottom anchor * fix(IndexBar): prettier --- packages/vant/src/index-bar/IndexBar.tsx | 32 +++++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/packages/vant/src/index-bar/IndexBar.tsx b/packages/vant/src/index-bar/IndexBar.tsx index d127039a0..5213aebdd 100644 --- a/packages/vant/src/index-bar/IndexBar.tsx +++ b/packages/vant/src/index-bar/IndexBar.tsx @@ -81,6 +81,7 @@ export default defineComponent({ const touch = useTouch(); const scrollParent = useScrollParent(root); const { children, linkChildren } = useChildren(INDEX_BAR_KEY); + let selectActiveIndex: string; linkChildren({ props }); @@ -116,6 +117,9 @@ export default defineComponent({ return -1; }; + const getMatchAnchor = (index: string) => + children.find((item) => String(item.index) === index); + const onScroll = () => { if (isHidden(root)) { return; @@ -129,7 +133,16 @@ export default defineComponent({ item.getRect(scrollParent.value, scrollParentRect) ); - const active = getActiveAnchor(scrollTop, rects); + let active = -1; + if (selectActiveIndex) { + const match = getMatchAnchor(selectActiveIndex); + if (match) { + const rect = match.getRect(scrollParent.value, scrollParentRect); + active = getActiveAnchor(rect.top, rects); + } + } else { + active = getActiveAnchor(scrollTop, rects); + } activeAnchor.value = indexList[active]; @@ -150,7 +163,7 @@ export default defineComponent({ state.top = Math.max(props.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top; - } else if (index === active - 1) { + } else if (index === active - 1 && selectActiveIndex === '') { const activeItemTop = rects[active].top - scrollTop; state.active = activeItemTop > 0; state.top = @@ -160,6 +173,8 @@ export default defineComponent({ } }); } + + selectActiveIndex = ''; }; const init = () => { @@ -193,10 +208,19 @@ export default defineComponent({ }); const scrollTo = (index: string | number) => { - index = String(index); - const match = children.find((item) => String(item.index) === index); + selectActiveIndex = String(index); + const match = getMatchAnchor(selectActiveIndex); if (match) { + const scrollTop = getScrollTop(scrollParent.value!); + const scrollParentRect = useRect(scrollParent); + const { offsetHeight } = document.documentElement; + + if (scrollTop === offsetHeight - scrollParentRect.height) { + onScroll(); + return; + } + match.$el.scrollIntoView(); if (props.sticky && props.stickyOffsetTop) { From 12e1a601c8f715966396bd2239e02fddcb336146 Mon Sep 17 00:00:00 2001 From: hipi <22478003+hipi@users.noreply.github.com> Date: Fri, 18 Mar 2022 16:35:22 +0800 Subject: [PATCH 08/10] feat(area-data): update counties of NanJing (#10410) --- packages/vant-area-data/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vant-area-data/src/index.ts b/packages/vant-area-data/src/index.ts index c67673a0d..5c8ef7332 100644 --- a/packages/vant-area-data/src/index.ts +++ b/packages/vant-area-data/src/index.ts @@ -1175,6 +1175,7 @@ export const areaList = { 320105: '建邺区', 320106: '鼓楼区', 320111: '浦口区', + 320112: '江北新区', 320113: '栖霞区', 320114: '雨花台区', 320115: '江宁区', From 029c93a4669ff3ee4d88615adb000668535f46d0 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Fri, 18 Mar 2022 16:36:29 +0800 Subject: [PATCH 09/10] release: @vant/area-data 1.2.3 --- packages/vant-area-data/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant-area-data/package.json b/packages/vant-area-data/package.json index 1085b649b..4657d0bd1 100644 --- a/packages/vant-area-data/package.json +++ b/packages/vant-area-data/package.json @@ -1,6 +1,6 @@ { "name": "@vant/area-data", - "version": "1.2.2", + "version": "1.2.3", "description": "Vant 省市区数据", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", From 61e2d5e0e101e8e371e77a782b6d295ba736d7bb Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 19 Mar 2022 19:37:22 +0800 Subject: [PATCH 10/10] chore: update codesandbox template to vant 3 (#10412) --- .github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml | 2 +- .github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml | 2 +- .github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml b/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml index c778ac024..1383c7a5a 100644 --- a/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml +++ b/.github/ISSUE_TEMPLATE/template-1-bug-report-vant.zh-CN.yml @@ -16,7 +16,7 @@ body: id: reproduce attributes: label: 重现链接 - description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/m5v3f) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 + description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/vant-3-issue-template-8fuq5o) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 validations: required: true diff --git a/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml b/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml index 929bc04d5..bfa3a70cc 100644 --- a/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml +++ b/.github/ISSUE_TEMPLATE/template-2-bug-report-vant-cli.zh-CN.yml @@ -16,7 +16,7 @@ body: id: reproduce attributes: label: 重现链接 - description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/m5v3f) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 + description: 请提供一个尽可能简单的 [codesandbox](https://codesandbox.io/s/vant-3-issue-template-8fuq5o) 或 GitHub 仓库链接。不要填写无效的链接,这会导致你的 issue 被直接关闭。 validations: required: true diff --git a/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml b/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml index 669444b35..5ec2e8adc 100644 --- a/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml +++ b/.github/ISSUE_TEMPLATE/template-5-bug-report-vant.en-US.yml @@ -7,7 +7,7 @@ body: id: reproduce attributes: label: Reproduction Link - description: Please provide a simple [codesandbox](https://codesandbox.io/s/m5v3f) or GitHub repository link. Do not fill in invalid links, this will cause your issue to be closed directly. + description: Please provide a simple [codesandbox](https://codesandbox.io/s/vant-3-issue-template-8fuq5o) or GitHub repository link. Do not fill in invalid links, this will cause your issue to be closed directly. validations: required: true