From 54aff040399087daf0c0f0ed7641093eb7440d88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Jul 2021 09:53:55 +0800 Subject: [PATCH 01/13] build(deps-dev): bump miniprogram-api-typings from 3.3.1 to 3.4.1 (#4331) Bumps [miniprogram-api-typings](https://github.com/wechat-miniprogram/api-typings) from 3.3.1 to 3.4.1. - [Release notes](https://github.com/wechat-miniprogram/api-typings/releases) - [Changelog](https://github.com/wechat-miniprogram/api-typings/blob/master/CHANGELOG.md) - [Commits](https://github.com/wechat-miniprogram/api-typings/compare/3.3.1...3.4.1) --- updated-dependencies: - dependency-name: miniprogram-api-typings dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a47d5b89..0d9f55e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11065,9 +11065,9 @@ minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5: integrity sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI= miniprogram-api-typings@^3.1.6: - version "3.3.1" - resolved "https://registry.yarnpkg.com/miniprogram-api-typings/-/miniprogram-api-typings-3.3.1.tgz#1cc58437873fe01c1b4f382aa7630bd73d848c42" - integrity sha512-3MTHaLgcuaLlMiEIVn3OdzJjLKgZfkpV/KrwxUYIL/+4b4BM6TAFYcwsXmQH7edOG9AUwU7pkQESpzE0ZjpPUQ== + version "3.4.1" + resolved "https://registry.yarnpkg.com/miniprogram-api-typings/-/miniprogram-api-typings-3.4.1.tgz#17cef4c184d32b2e12e2deb5559d1c01c84fa891" + integrity sha512-kGUJ4zLgwzGyhtCOR2DTz8LTPkKJVek9OqspzGoMVcrmAKV76WqJ6sEOwJoQ1kO/VlTuXEKCu9+ZXB7hFKLcmw== miniprogram-ci@^1.0.27: version "1.2.3" From c7a81a0d7432fdb12b11fde809d20c941b5fdbdb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Jul 2021 09:59:41 +0800 Subject: [PATCH 02/13] build(deps-dev): bump @vant/cli from 3.11.0 to 3.11.1 (#4332) Bumps [@vant/cli](https://github.com/youzan/vant) from 3.11.0 to 3.11.1. - [Release notes](https://github.com/youzan/vant/releases) - [Commits](https://github.com/youzan/vant/commits) --- updated-dependencies: - dependency-name: "@vant/cli" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0d9f55e5..f898f324 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3215,9 +3215,9 @@ eslint-visitor-keys "^2.0.0" "@vant/cli@^3.10.3": - version "3.11.0" - resolved "https://registry.yarnpkg.com/@vant/cli/-/cli-3.11.0.tgz#95812fd72f15c844b2a81f974e85901219a599ec" - integrity sha512-MERBUKZlJvbQT8JJVKkoxL0z532uXHnT5lfs9puszi9uvxLV042PuTm2eF/CAz5mwV5jEZyTapMTZBpmOfLuUA== + version "3.11.1" + resolved "https://registry.yarnpkg.com/@vant/cli/-/cli-3.11.1.tgz#131977e0df7522ff845fa2c8f6304abfd7d33f73" + integrity sha512-tGvXjOKQZfJC/AqGz8W17ONdaYliqqKAz0ZK/fWb7B2vYIYtpLUdaLL/qhU5NYsrJuddC0jQ6XnBzR1lTER0+A== dependencies: "@babel/core" "^7.14.5" "@babel/preset-env" "^7.14.5" From 95032ed2902ee60143f9de2df6ce34cc32c3edb2 Mon Sep 17 00:00:00 2001 From: shuhanxu Date: Sun, 11 Jul 2021 23:58:45 -0700 Subject: [PATCH 03/13] feat(search): add new event click-input (#4337) * Update index.wxml * Update index.js * Update README.md * Update README.md --- lib/search/index.js | 3 +++ lib/search/index.wxml | 1 + packages/search/README.md | 1 + 3 files changed, 5 insertions(+) diff --git a/lib/search/index.js b/lib/search/index.js index 2e61ab9b..d2ba33b9 100644 --- a/lib/search/index.js +++ b/lib/search/index.js @@ -77,5 +77,8 @@ component_1.VantComponent({ onClear: function (event) { this.$emit('clear', event.detail); }, + onClickInput: function (event) { + this.$emit('click-input', event.detail); + }, }, }); diff --git a/lib/search/index.wxml b/lib/search/index.wxml index 1d0e6f1f..5d77fca8 100644 --- a/lib/search/index.wxml +++ b/lib/search/index.wxml @@ -32,6 +32,7 @@ bind:change="onChange" bind:confirm="onSearch" bind:clear="onClear" + bind:click-input="onClickInput" > diff --git a/packages/search/README.md b/packages/search/README.md index 9439f865..2aa1293c 100644 --- a/packages/search/README.md +++ b/packages/search/README.md @@ -145,6 +145,7 @@ Page({ | bind:focus | 输入框聚焦时触发 | - | | bind:blur | 输入框失焦时触发 | - | | bind:clear | 点击清空控件时触发 | - | +| bind:click-input | 点击搜索区域时触发 | - | ### Slot From 853c56b26d129fa2eeaf1442482b940782f6917f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 09:50:37 +0800 Subject: [PATCH 04/13] build(deps-dev): bump @vant/cli from 3.11.1 to 3.11.2 (#4340) Bumps [@vant/cli](https://github.com/youzan/vant) from 3.11.1 to 3.11.2. - [Release notes](https://github.com/youzan/vant/releases) - [Commits](https://github.com/youzan/vant/commits) --- updated-dependencies: - dependency-name: "@vant/cli" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f898f324..32e6d392 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3215,9 +3215,9 @@ eslint-visitor-keys "^2.0.0" "@vant/cli@^3.10.3": - version "3.11.1" - resolved "https://registry.yarnpkg.com/@vant/cli/-/cli-3.11.1.tgz#131977e0df7522ff845fa2c8f6304abfd7d33f73" - integrity sha512-tGvXjOKQZfJC/AqGz8W17ONdaYliqqKAz0ZK/fWb7B2vYIYtpLUdaLL/qhU5NYsrJuddC0jQ6XnBzR1lTER0+A== + version "3.11.2" + resolved "https://registry.yarnpkg.com/@vant/cli/-/cli-3.11.2.tgz#d6a91160b6d64a8a302bebff1858ef8ea3671b0c" + integrity sha512-8sd61UqKHBsCkc3K1wrymuo9f6JxRFfKbX6nq5rlexygZLmoydKgXL8fpB9w3uhriiJJLt3JKNm6Q8k49IjyeA== dependencies: "@babel/core" "^7.14.5" "@babel/preset-env" "^7.14.5" From 82811d4058f917e44b97bfdae5fb3ef0b6c94195 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Fri, 16 Jul 2021 17:32:55 +0800 Subject: [PATCH 05/13] fix(Calendar): set current date is inital (#4339) * feat(Calendar): set current date is inital * fix(Calendar): adjust limitDateRange --- packages/calendar/index.ts | 72 ++++++++++++++++++++++++++++++-------- packages/calendar/utils.ts | 6 ++++ 2 files changed, 64 insertions(+), 14 deletions(-) diff --git a/packages/calendar/index.ts b/packages/calendar/index.ts index c79539bc..795a5870 100644 --- a/packages/calendar/index.ts +++ b/packages/calendar/index.ts @@ -1,7 +1,9 @@ import { VantComponent } from '../common/component'; import { ROW_HEIGHT, + getPrevDay, getNextDay, + getToday, compareDay, copyDates, calcDateNum, @@ -14,6 +16,16 @@ import { import Toast from '../toast/toast'; import { requestAnimationFrame } from '../common/utils'; +const initialMinDate = getToday().getTime(); +const initialMaxDate = (() => { + const now = getToday(); + return new Date( + now.getFullYear(), + now.getMonth() + 6, + now.getDate() + ).getTime(); +})(); + VantComponent({ props: { title: { @@ -56,15 +68,11 @@ VantComponent({ }, minDate: { type: null, - value: Date.now(), + value: initialMinDate, }, maxDate: { type: null, - value: new Date( - new Date().getFullYear(), - new Date().getMonth() + 6, - new Date().getDate() - ).getTime(), + value: initialMaxDate, }, position: { type: String, @@ -162,22 +170,58 @@ VantComponent({ }); }, - getInitialDate() { - const { type, defaultDate, minDate } = this.data; + limitDateRange( + date: number, + minDate: number | null = null, + maxDate: number | null = null + ) { + minDate = minDate || (this.data.minDate as number); + maxDate = maxDate || (this.data.maxDate as number); + if (compareDay(date, minDate) === -1) { + return minDate; + } + if (compareDay(date, maxDate) === 1) { + return maxDate; + } + return date; + }, + + getInitialDate(defaultDate: number | number[] | null = null) { + const { type, minDate, maxDate } = this.data; + + const now = getToday().getTime(); if (type === 'range') { + if (!Array.isArray(defaultDate)) { + defaultDate = []; + } + const [startDay, endDay] = defaultDate || []; - return [ - startDay || minDate, - endDay || getNextDay(new Date(minDate)).getTime(), - ]; + + const start = this.limitDateRange( + startDay || now, + minDate, + getPrevDay(maxDate).getTime() + ); + const end = this.limitDateRange( + endDay || now, + getNextDay(minDate).getTime() + ); + return [start, end]; } if (type === 'multiple') { - return defaultDate || [minDate]; + if (Array.isArray(defaultDate)) { + return defaultDate.map((date) => this.limitDateRange(date)); + } + + return [this.limitDateRange(now)]; } - return defaultDate || minDate; + if (!defaultDate || Array.isArray(defaultDate)) { + defaultDate = now; + } + return this.limitDateRange(defaultDate); }, scrollIntoView() { diff --git a/packages/calendar/utils.ts b/packages/calendar/utils.ts index 0b43e24b..a19a0559 100644 --- a/packages/calendar/utils.ts +++ b/packages/calendar/utils.ts @@ -64,6 +64,12 @@ export function getNextDay(date: Date) { return getDayByOffset(date, 1); } +export function getToday() { + const today = new Date(); + today.setHours(0, 0, 0, 0); + return today; +} + export function calcDateNum(date: [Date, Date]) { const day1 = new Date(date[0]).getTime(); const day2 = new Date(date[1]).getTime(); From 98721b7b7e2a1fa032a465e5f653a14af1a85db5 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Mon, 19 Jul 2021 12:24:56 +0800 Subject: [PATCH 06/13] feat(Cell): cell-group inset prop (#4341) * feat(Cell): cell-group inset prop * fix(Cell): remove inset prop default value --- example/pages/cell/index.wxml | 7 +++++ packages/cell-group/index.less | 11 +++++++ packages/cell-group/index.ts | 1 + packages/cell-group/index.wxml | 6 ++-- packages/cell/README.md | 56 +++++++++++++++++++++------------- packages/common/style/var.less | 3 ++ 6 files changed, 60 insertions(+), 24 deletions(-) diff --git a/example/pages/cell/index.wxml b/example/pages/cell/index.wxml index ebf0bdd7..72130cb3 100644 --- a/example/pages/cell/index.wxml +++ b/example/pages/cell/index.wxml @@ -10,6 +10,13 @@ + + + + + + + + {{ title }} - + diff --git a/packages/cell/README.md b/packages/cell/README.md index 60172908..db8290fd 100644 --- a/packages/cell/README.md +++ b/packages/cell/README.md @@ -28,6 +28,17 @@ ``` +### 卡片风格 + +通过 `CellGroup` 的 `inset` 属性,可以将单元格转换为圆角卡片风格(从 1.7.2 版本开始支持)。 + +```html + + + + +``` + ### 单元格大小 通过`size`属性可以控制单元格的大小。 @@ -109,10 +120,11 @@ ### CellGroup Props -| 参数 | 说明 | 类型 | 默认值 | 版本 | -| ------ | -------------- | --------- | ------ | ---- | -| title | 分组标题 | _string_ | `-` | - | -| border | 是否显示外边框 | _boolean_ | `true` | - | +| 参数 | 说明 | 类型 | 默认值 | +| -------------- | ---------------------- | --------- | ------- | +| title | 分组标题 | _string_ | `-` | +| inset `v1.7.2` | 是否展示为圆角卡片风格 | _boolean_ | `false` | +| border | 是否显示外边框 | _boolean_ | `true` | ### CellGroup 外部样式类 @@ -122,24 +134,24 @@ ### Cell Props -| 参数 | 说明 | 类型 | 默认值 | 版本 | -| --- | --- | --- | --- | --- | -| icon | 左侧图标名称或图片链接,可选值见 [Icon 组件](#/icon) | _string_ | - | - | -| title | 左侧标题 | _string \| number_ | - | -| title-width | 标题宽度,须包含单位 | _string_ | - | - | -| value | 右侧内容 | _string \| number_ | - | - | -| label | 标题下方的描述信息 | _string_ | - | - | -| size | 单元格大小,可选值为 `large` | _string_ | - | - | -| border | 是否显示下边框 | _boolean_ | `true` | - | -| center | 是否使内容垂直居中 | _boolean_ | `false` | - | -| url | 点击后跳转的链接地址 | _string_ | - | - | -| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` | - | -| clickable | 是否开启点击反馈 | _boolean_ | `false` | - | -| is-link | 是否展示右侧箭头并开启点击反馈 | _boolean_ | `false` | - | -| required | 是否显示表单必填星号 | _boolean_ | `false` | - | -| arrow-direction | 箭头方向,可选值为 `left` `up` `down` | _string_ | - | - | -| use-label-slot | 是否使用 label slot | _boolean_ | `false` | - | -| title-style | 标题样式 | _string_ | - | 1.4.0 | +| 参数 | 说明 | 类型 | 默认值 | +| -------------------- | ---------------------------------------------------------- | ------------------ | ------------ | +| icon | 左侧图标名称或图片链接,可选值见 [Icon 组件](#/icon) | _string_ | - | +| title | 左侧标题 | _string \| number_ | - | +| title-width | 标题宽度,须包含单位 | _string_ | - | +| value | 右侧内容 | _string \| number_ | - | +| label | 标题下方的描述信息 | _string_ | - | +| size | 单元格大小,可选值为 `large` | _string_ | - | +| border | 是否显示下边框 | _boolean_ | `true` | +| center | 是否使内容垂直居中 | _boolean_ | `false` | +| url | 点击后跳转的链接地址 | _string_ | - | +| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` | +| clickable | 是否开启点击反馈 | _boolean_ | `false` | +| is-link | 是否展示右侧箭头并开启点击反馈 | _boolean_ | `false` | +| required | 是否显示表单必填星号 | _boolean_ | `false` | +| arrow-direction | 箭头方向,可选值为 `left` `up` `down` | _string_ | - | +| use-label-slot | 是否使用 label slot | _boolean_ | `false` | +| title-style `v1.4.0` | 标题样式 | _string_ | - | ### Cell Event diff --git a/packages/common/style/var.less b/packages/common/style/var.less index 601334ee..c66eb8f8 100644 --- a/packages/common/style/var.less +++ b/packages/common/style/var.less @@ -193,6 +193,9 @@ @cell-group-title-padding: @padding-md @padding-md @padding-xs; @cell-group-title-font-size: @font-size-md; @cell-group-title-line-height: 16px; +@cell-group-inset-padding: 0 @padding-md; +@cell-group-inset-border-radius: @border-radius-lg; +@cell-group-inset-title-padding: @padding-md @padding-md @padding-xs @padding-xl; // Checkbox @checkbox-size: 20px; From 1bbc24b7422d3df0486f2da7c3ace77e8b1df744 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Mon, 19 Jul 2021 23:40:05 +0800 Subject: [PATCH 07/13] build: compile 1.7.2 --- dist/calendar/index.js | 62 ++++++++++++++++++++++++-------- dist/calendar/utils.d.ts | 1 + dist/calendar/utils.js | 5 +++ dist/cell-group/index.js | 1 + dist/cell-group/index.wxml | 6 ++-- dist/cell-group/index.wxss | 2 +- lib/calendar/index.js | 74 ++++++++++++++++++++++++++++++-------- lib/calendar/utils.js | 8 ++++- lib/cell-group/index.js | 1 + lib/cell-group/index.wxml | 6 ++-- lib/cell-group/index.wxss | 2 +- lib/search/index.js | 3 -- lib/search/index.wxml | 1 - 13 files changed, 132 insertions(+), 40 deletions(-) diff --git a/dist/calendar/index.js b/dist/calendar/index.js index 08dad0be..7fa6a5d0 100644 --- a/dist/calendar/index.js +++ b/dist/calendar/index.js @@ -1,7 +1,9 @@ import { VantComponent } from '../common/component'; import { ROW_HEIGHT, + getPrevDay, getNextDay, + getToday, compareDay, copyDates, calcDateNum, @@ -12,6 +14,15 @@ import { } from './utils'; import Toast from '../toast/toast'; import { requestAnimationFrame } from '../common/utils'; +const initialMinDate = getToday().getTime(); +const initialMaxDate = (() => { + const now = getToday(); + return new Date( + now.getFullYear(), + now.getMonth() + 6, + now.getDate() + ).getTime(); +})(); VantComponent({ props: { title: { @@ -54,15 +65,11 @@ VantComponent({ }, minDate: { type: null, - value: Date.now(), + value: initialMinDate, }, maxDate: { type: null, - value: new Date( - new Date().getFullYear(), - new Date().getMonth() + 6, - new Date().getDate() - ).getTime(), + value: initialMaxDate, }, position: { type: String, @@ -151,19 +158,46 @@ VantComponent({ } }); }, - getInitialDate() { - const { type, defaultDate, minDate } = this.data; + limitDateRange(date, minDate = null, maxDate = null) { + minDate = minDate || this.data.minDate; + maxDate = maxDate || this.data.maxDate; + if (compareDay(date, minDate) === -1) { + return minDate; + } + if (compareDay(date, maxDate) === 1) { + return maxDate; + } + return date; + }, + getInitialDate(defaultDate = null) { + const { type, minDate, maxDate } = this.data; + const now = getToday().getTime(); if (type === 'range') { + if (!Array.isArray(defaultDate)) { + defaultDate = []; + } const [startDay, endDay] = defaultDate || []; - return [ - startDay || minDate, - endDay || getNextDay(new Date(minDate)).getTime(), - ]; + const start = this.limitDateRange( + startDay || now, + minDate, + getPrevDay(maxDate).getTime() + ); + const end = this.limitDateRange( + endDay || now, + getNextDay(minDate).getTime() + ); + return [start, end]; } if (type === 'multiple') { - return defaultDate || [minDate]; + if (Array.isArray(defaultDate)) { + return defaultDate.map((date) => this.limitDateRange(date)); + } + return [this.limitDateRange(now)]; } - return defaultDate || minDate; + if (!defaultDate || Array.isArray(defaultDate)) { + defaultDate = now; + } + return this.limitDateRange(defaultDate); }, scrollIntoView() { requestAnimationFrame(() => { diff --git a/dist/calendar/utils.d.ts b/dist/calendar/utils.d.ts index 17fc0779..ec7cf3f4 100644 --- a/dist/calendar/utils.d.ts +++ b/dist/calendar/utils.d.ts @@ -11,6 +11,7 @@ export declare function compareDay( export declare function getDayByOffset(date: Date, offset: number): Date; export declare function getPrevDay(date: Date): Date; export declare function getNextDay(date: Date): Date; +export declare function getToday(): Date; export declare function calcDateNum(date: [Date, Date]): number; export declare function copyDates(dates: Date | Date[]): Date | Date[]; export declare function getMonthEndDay(year: number, month: number): number; diff --git a/dist/calendar/utils.js b/dist/calendar/utils.js index 281a35c9..f773e7f5 100644 --- a/dist/calendar/utils.js +++ b/dist/calendar/utils.js @@ -47,6 +47,11 @@ export function getPrevDay(date) { export function getNextDay(date) { return getDayByOffset(date, 1); } +export function getToday() { + const today = new Date(); + today.setHours(0, 0, 0, 0); + return today; +} export function calcDateNum(date) { const day1 = new Date(date[0]).getTime(); const day2 = new Date(date[1]).getTime(); diff --git a/dist/cell-group/index.js b/dist/cell-group/index.js index 99bcdb9e..5f76bb55 100644 --- a/dist/cell-group/index.js +++ b/dist/cell-group/index.js @@ -6,5 +6,6 @@ VantComponent({ type: Boolean, value: true, }, + inset: Boolean, }, }); diff --git a/dist/cell-group/index.wxml b/dist/cell-group/index.wxml index 6e0b471d..311e064a 100644 --- a/dist/cell-group/index.wxml +++ b/dist/cell-group/index.wxml @@ -1,9 +1,11 @@ + + {{ title }} - + diff --git a/dist/cell-group/index.wxss b/dist/cell-group/index.wxss index edbccd59..5bc5d0f4 100644 --- a/dist/cell-group/index.wxss +++ b/dist/cell-group/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)} \ No newline at end of file +@import '../common/index.wxss';.van-cell-group--inset{margin:0 16px;margin:var(--cell-group-inset-padding,0 16px);border-radius:8px;border-radius:var(--cell-group-inset-border-radius,8px);overflow:hidden}.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}.van-cell-group__title--inset{padding:16px 16px 8px 32px;padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)} \ No newline at end of file diff --git a/lib/calendar/index.js b/lib/calendar/index.js index 1db8d75e..1dafdad3 100644 --- a/lib/calendar/index.js +++ b/lib/calendar/index.js @@ -16,6 +16,15 @@ var component_1 = require('../common/component'); var utils_1 = require('./utils'); var toast_1 = __importDefault(require('../toast/toast')); var utils_2 = require('../common/utils'); +var initialMinDate = utils_1.getToday().getTime(); +var initialMaxDate = (function () { + var now = utils_1.getToday(); + return new Date( + now.getFullYear(), + now.getMonth() + 6, + now.getDate() + ).getTime(); +})(); component_1.VantComponent({ props: { title: { @@ -58,15 +67,11 @@ component_1.VantComponent({ }, minDate: { type: null, - value: Date.now(), + value: initialMinDate, }, maxDate: { type: null, - value: new Date( - new Date().getFullYear(), - new Date().getMonth() + 6, - new Date().getDate() - ).getTime(), + value: initialMaxDate, }, position: { type: String, @@ -158,24 +163,63 @@ component_1.VantComponent({ } }); }, - getInitialDate: function () { + limitDateRange: function (date, minDate, maxDate) { + if (minDate === void 0) { + minDate = null; + } + if (maxDate === void 0) { + maxDate = null; + } + minDate = minDate || this.data.minDate; + maxDate = maxDate || this.data.maxDate; + if (utils_1.compareDay(date, minDate) === -1) { + return minDate; + } + if (utils_1.compareDay(date, maxDate) === 1) { + return maxDate; + } + return date; + }, + getInitialDate: function (defaultDate) { + var _this = this; + if (defaultDate === void 0) { + defaultDate = null; + } var _a = this.data, type = _a.type, - defaultDate = _a.defaultDate, - minDate = _a.minDate; + minDate = _a.minDate, + maxDate = _a.maxDate; + var now = utils_1.getToday().getTime(); if (type === 'range') { + if (!Array.isArray(defaultDate)) { + defaultDate = []; + } var _b = defaultDate || [], startDay = _b[0], endDay = _b[1]; - return [ - startDay || minDate, - endDay || utils_1.getNextDay(new Date(minDate)).getTime(), - ]; + var start = this.limitDateRange( + startDay || now, + minDate, + utils_1.getPrevDay(maxDate).getTime() + ); + var end = this.limitDateRange( + endDay || now, + utils_1.getNextDay(minDate).getTime() + ); + return [start, end]; } if (type === 'multiple') { - return defaultDate || [minDate]; + if (Array.isArray(defaultDate)) { + return defaultDate.map(function (date) { + return _this.limitDateRange(date); + }); + } + return [this.limitDateRange(now)]; } - return defaultDate || minDate; + if (!defaultDate || Array.isArray(defaultDate)) { + defaultDate = now; + } + return this.limitDateRange(defaultDate); }, scrollIntoView: function () { var _this = this; diff --git a/lib/calendar/utils.js b/lib/calendar/utils.js index cdd1a0cb..37e14c2a 100644 --- a/lib/calendar/utils.js +++ b/lib/calendar/utils.js @@ -1,6 +1,6 @@ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); -exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0; +exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0; exports.ROW_HEIGHT = 64; function formatMonthTitle(date) { if (!(date instanceof Date)) { @@ -56,6 +56,12 @@ function getNextDay(date) { return getDayByOffset(date, 1); } exports.getNextDay = getNextDay; +function getToday() { + var today = new Date(); + today.setHours(0, 0, 0, 0); + return today; +} +exports.getToday = getToday; function calcDateNum(date) { var day1 = new Date(date[0]).getTime(); var day2 = new Date(date[1]).getTime(); diff --git a/lib/cell-group/index.js b/lib/cell-group/index.js index 7d934870..fc0f6645 100644 --- a/lib/cell-group/index.js +++ b/lib/cell-group/index.js @@ -8,5 +8,6 @@ component_1.VantComponent({ type: Boolean, value: true, }, + inset: Boolean, }, }); diff --git a/lib/cell-group/index.wxml b/lib/cell-group/index.wxml index 6e0b471d..311e064a 100644 --- a/lib/cell-group/index.wxml +++ b/lib/cell-group/index.wxml @@ -1,9 +1,11 @@ + + {{ title }} - + diff --git a/lib/cell-group/index.wxss b/lib/cell-group/index.wxss index edbccd59..5bc5d0f4 100644 --- a/lib/cell-group/index.wxss +++ b/lib/cell-group/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)} \ No newline at end of file +@import '../common/index.wxss';.van-cell-group--inset{margin:0 16px;margin:var(--cell-group-inset-padding,0 16px);border-radius:8px;border-radius:var(--cell-group-inset-border-radius,8px);overflow:hidden}.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}.van-cell-group__title--inset{padding:16px 16px 8px 32px;padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)} \ No newline at end of file diff --git a/lib/search/index.js b/lib/search/index.js index d2ba33b9..2e61ab9b 100644 --- a/lib/search/index.js +++ b/lib/search/index.js @@ -77,8 +77,5 @@ component_1.VantComponent({ onClear: function (event) { this.$emit('clear', event.detail); }, - onClickInput: function (event) { - this.$emit('click-input', event.detail); - }, }, }); diff --git a/lib/search/index.wxml b/lib/search/index.wxml index 5d77fca8..1d0e6f1f 100644 --- a/lib/search/index.wxml +++ b/lib/search/index.wxml @@ -32,7 +32,6 @@ bind:change="onChange" bind:confirm="onSearch" bind:clear="onClear" - bind:click-input="onClickInput" > From 98b1c990070a829bfd30e96bcc270d3d9909ebe9 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Mon, 19 Jul 2021 23:40:11 +0800 Subject: [PATCH 08/13] build: release 1.7.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f32bd5f..007d3772 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vant/weapp", - "version": "1.7.1", + "version": "1.7.2", "author": "youzan", "license": "MIT", "miniprogram": "lib", From 0271e81d73900e2a603dfdf4e8c9219a60c91419 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Mon, 19 Jul 2021 23:47:58 +0800 Subject: [PATCH 09/13] docs(changelog): 1.7.2 --- docs/markdown/changelog.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md index 23cf5925..beec4e7c 100644 --- a/docs/markdown/changelog.md +++ b/docs/markdown/changelog.md @@ -1,5 +1,18 @@ # 更新日志 +### [1.7.2](https://github.com/youzan/vant-weapp/tree/v1.7.2) + +`2021-07-19` + +**Bug Fixes** + + - Calendar: 初始日期设置为当前日期 [#4339](https://github.com/youzan/vant-weapp/issues/4339) + +**Features** + + - Cell: CellGroup 新增 inset 属性 [#4341](https://github.com/youzan/vant-weapp/issues/4341) + - Search: 新增click-input 事件 [#4337](https://github.com/youzan/vant-weapp/issues/4337) + ### [1.7.1](https://github.com/youzan/vant-weapp/tree/v1.7.1) `2021-07-06` From 35b90ed23ca7cd0fd381ae63fc7401c3d8761e76 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Mon, 19 Jul 2021 23:54:50 +0800 Subject: [PATCH 10/13] docs(changelog): 1.7.2 --- docs/markdown/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md index beec4e7c..54414354 100644 --- a/docs/markdown/changelog.md +++ b/docs/markdown/changelog.md @@ -1,5 +1,6 @@ # 更新日志 + ### [1.7.2](https://github.com/youzan/vant-weapp/tree/v1.7.2) `2021-07-19` From 859f37c425251a82d0b2672532abd5ab717e50de Mon Sep 17 00:00:00 2001 From: shuhanxu Date: Wed, 21 Jul 2021 18:59:00 -0700 Subject: [PATCH 11/13] feat(search): add new event click-input (#4357) * Update index.wxml * Update index.ts --- packages/search/index.ts | 4 ++++ packages/search/index.wxml | 1 + 2 files changed, 5 insertions(+) diff --git a/packages/search/index.ts b/packages/search/index.ts index cd44e391..31243802 100644 --- a/packages/search/index.ts +++ b/packages/search/index.ts @@ -83,5 +83,9 @@ VantComponent({ onClear(event: WechatMiniprogram.CustomEvent) { this.$emit('clear', event.detail); }, + + onClickInput: function (event) { + this.$emit('click-input', event.detail); + }, }, }); diff --git a/packages/search/index.wxml b/packages/search/index.wxml index 1d0e6f1f..5d77fca8 100644 --- a/packages/search/index.wxml +++ b/packages/search/index.wxml @@ -32,6 +32,7 @@ bind:change="onChange" bind:confirm="onSearch" bind:clear="onClear" + bind:click-input="onClickInput" > From e9aa946db0ab8eb08c2050a5301eb1d0196c2532 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Jul 2021 09:55:42 +0800 Subject: [PATCH 12/13] build(deps-dev): bump @vant/icons from 1.6.0 to 1.7.0 (#4365) Bumps [@vant/icons](https://github.com/youzan/vant) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/youzan/vant/releases) - [Commits](https://github.com/youzan/vant/commits) --- updated-dependencies: - dependency-name: "@vant/icons" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 32e6d392..53ecc0f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3292,9 +3292,9 @@ eslint-plugin-vue "^7.1.0" "@vant/icons@^1.6.0": - version "1.6.0" - resolved "https://registry.npmjs.org/@vant/icons/-/icons-1.6.0.tgz#3db7eb7f963f51a2a08676720d5af9c4c3512feb" - integrity sha512-4Hvq4tl4grCOJLZ0e8ZaivBV8xOcmTPmTT8BDkTrEIKqnDowRFDdsXxcHECzWmbmMx+CYGdngvd2Cq8YR9DfKA== + version "1.7.0" + resolved "https://registry.yarnpkg.com/@vant/icons/-/icons-1.7.0.tgz#02d427532a8142c35db159da9c364fe6890c3ac9" + integrity sha512-sqKvtYcSgSd6+AU1nBPaZARn2Nzf8hi0ErLhfXVR6f+Y7R0gojGZVoxuB83yUI6+0LwbitW5IfN3E6qzEsu21Q== "@vant/markdown-loader@^4.1.0": version "4.1.0" From 3238dfed1ef537110d5e196982102e660163da1c Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 25 Jul 2021 10:53:21 +0800 Subject: [PATCH 13/13] docs(Uploader): fix uploadToCloud demo https://github.com/youzan/vant-weapp/issues/4360 --- packages/uploader/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uploader/README.md b/packages/uploader/README.md index 374dfa71..05b3edce 100644 --- a/packages/uploader/README.md +++ b/packages/uploader/README.md @@ -190,7 +190,7 @@ Page({ ```js // 上传图片 -uploadToCloud() { +uploadToCloud() { wx.cloud.init(); const { fileList } = this.data; if (!fileList.length) { @@ -200,7 +200,7 @@ uploadToCloud() { Promise.all(uploadTasks) .then(data => { wx.showToast({ title: '上传成功', icon: 'none' }); - const newFileList = data.map(item => { url: item.fileID }); + const newFileList = data.map(item => ({ url: item.fileID })); this.setData({ cloudPath: data, fileList: newFileList }); }) .catch(e => {