Compare commits

...

5 Commits

Author SHA1 Message Date
johnsonwong666
628008efb3
fix(Cascader): fix title slot inoperative (#5676) 2024-01-15 20:16:45 +08:00
johnsonwong666
3f8cc449d2
feat(Calendar、ActionSheet、Dialog、ShareSheet): add root portal prop (#5680) 2024-01-15 19:55:11 +08:00
dependabot[bot]
e2b031c436
build(deps-dev): bump miniprogram-api-typings from 3.12.1 to 3.12.2 (#5686)
Bumps [miniprogram-api-typings](https://github.com/wechat-miniprogram/api-typings) from 3.12.1 to 3.12.2.
- [Changelog](https://github.com/wechat-miniprogram/api-typings/blob/master/CHANGELOG.md)
- [Commits](https://github.com/wechat-miniprogram/api-typings/compare/v3.12.1...v3.12.2)

---
updated-dependencies:
- dependency-name: miniprogram-api-typings
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 19:53:33 +08:00
johnsonwong666
d1f505b8e8
feat(Upload): support mix mediaType #5690 2024-01-15 19:53:05 +08:00
johnsonwong666
19083a327c
fix(Transition): fix transition event sequence (#5699) 2024-01-15 19:47:25 +08:00
20 changed files with 90 additions and 61 deletions

View File

@ -166,6 +166,7 @@ Page({
| close-on-click-action | 是否在点击选项后关闭 | _boolean_ | `true` |
| close-on-click-overlay | 点击遮罩是否关闭菜单 | _boolean_ | `true` |
| safe-area-inset-bottom | 是否为 iPhoneX 留出底部安全距离 | _boolean_ | `true` |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### Events
@ -207,7 +208,7 @@ Page({
### 外部样式类
| 类名 | 说明 |
| ------------ | -------------- |
| custom-class `v1.10.7` | 根节点样式类 |
| list-class `v1.10.7` | `actions`容器样式类 |
| 类名 | 说明 |
| ---------------------- | ------------------- |
| custom-class `v1.10.7` | 根节点样式类 |
| list-class `v1.10.7` | `actions`容器样式类 |

View File

@ -38,6 +38,10 @@ VantComponent({
type: Boolean,
value: true,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {

View File

@ -9,6 +9,7 @@
custom-class="van-action-sheet custom-class"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-action-sheet__header">

View File

@ -286,6 +286,7 @@ Page({
| confirm-disabled-text | 确认按钮处于禁用状态时的文字 | _string_ | `确定` |
| first-day-of-week | 设置周起始日 | _0~6_ | `0` |
| readonly `v1.9.1` | 是否为只读状态,只读状态下不能选择日期 | _boolean_ | `false` |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### Poppable Props

View File

@ -136,6 +136,10 @@ VantComponent({
value: 0,
},
readonly: Boolean,
rootPortal: {
type: Boolean,
value: false,
},
},
data: {

View File

@ -13,6 +13,7 @@
closeable="{{ showTitle || showSubtitle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:enter="onOpen"
bind:close="onClose"
bind:after-enter="onOpened"

View File

@ -213,6 +213,7 @@ Page({
| show-header | 是否展示标题栏 | _boolean_ | `true` |
| close-icon | 关闭图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/icon) | _string_ | `cross` |
| field-names | 自定义 `options` 结构中的字段 | _CascaderFieldNames_ | `{ text: 'text', value: 'value', children: 'children' }` |
| use-title-slot `v1.11.3` | 是否使用自定义标题的插槽 | _boolean_ | `false` |
### CascaderOption 数据结构

View File

@ -58,6 +58,7 @@ VantComponent({
value: defaultFieldNames,
observer: 'updateFieldNames',
},
useTitleSlot: Boolean,
},
data: {

View File

@ -1,7 +1,8 @@
<wxs src="./index.wxs" module="utils" />
<view wx:if="{{ showHeader }}" class="van-cascader__header">
<text class="van-cascader__title"><slot name="title"></slot>{{ title }}</text>
<slot name="title" wx:if="{{ useTitleSlot }}"></slot>
<text class="van-cascader__title" wx:else>{{ title }}</text>
<van-icon
wx:if="{{ closeable }}"
name="{{ closeIcon }}"

View File

@ -266,6 +266,7 @@ Page({
| before-close | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(action) => boolean \| Promise\<boolean\>_ | - |
| transition | 动画名称,可选值为`fade` | _string_ | `scale` |
| confirm-button-open-type | 确认按钮的微信开放能力,具体支持可参考 [微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html) | _string_ | - |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### OpenType Props

View File

@ -68,6 +68,10 @@ VantComponent({
type: String,
value: 'scale',
},
rootPortal: {
type: Boolean,
value: false,
},
},
data: {

View File

@ -9,6 +9,7 @@
custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
root-portal="{{ rootPortal }}"
bind:close="onClickOverlay"
>
<view

View File

@ -53,75 +53,81 @@ export function transition(showDefaultValue: boolean) {
},
enter() {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
this.waitEnterEndPromise = new Promise((resolve) => {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
if (this.status === 'enter') {
return;
}
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
if (this.status === 'enter') {
return;
}
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
resolve();
});
});
});
},
leave() {
if (!this.data.display) {
return;
}
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
if (!this.waitEnterEndPromise) return;
this.waitEnterEndPromise.then(() => {
if (!this.data.display) {
return;
}
this.$emit('leave');
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.setData({
classes: classNames.leave,
currentDuration,
});
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => this.onTransitionEnd(), currentDuration);
this.$emit('leave');
this.setData({ classes: classNames['leave-to'] });
this.setData({
classes: classNames.leave,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => this.onTransitionEnd(), currentDuration);
this.setData({ classes: classNames['leave-to'] });
});
});
});
},

View File

@ -168,6 +168,7 @@ Page({
| overlay | 是否显示遮罩层 | _boolean_ | `true` |
| close-on-click-overlay | 是否在点击遮罩层后关闭 | _boolean_ | `true` |
| safe-area-inset-bottom | 是否开启底部安全区适配 | _boolean_ | `true` |
| root-portal `v1.11.3` | 是否从页面子树中脱离出来,用于解决各种 fixed 失效问题,微信基础库 >= `2.25.2 ` | _boolean_ | `false` |
### Option 数据结构

View File

@ -37,6 +37,10 @@ VantComponent({
type: null,
value: 300,
},
rootPortal: {
type: Boolean,
value: false,
},
},
methods: {

View File

@ -11,6 +11,7 @@
overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
root-portal="{{ rootPortal }}"
bind:close="onClose"
bind:click-overlay="onClickOverlay"
>

View File

@ -244,7 +244,7 @@ uploadFilePromise(fileName, chooseResult) {
| camera | 当 accept 为 `video` \| `media` 时生效,可选值为 `back` `front` | _string_ | - |
| compressed | 当 accept 为 `video` 时生效,是否压缩视频,默认为`true` | _boolean_ | - |
| max-duration | 当 accept 为 `video` \| `media` 时生效,拍摄视频最长拍摄时间,单位秒 | _number_ | `60` |
| media-type `v1.10.8` | 当 accept 为 `media` 时生效,选择的文件的文件类型,可选值为 `image` `video` | _string[]_ | `['image', 'video']` |
| media-type `v1.10.8` | 当 accept 为 `media` 时生效,选择的文件的文件类型,可选值为 `image` `video` `mix` | _string[]_ | `['image', 'video', 'mix']` |
| extension `v1.10.11` | 当 accept 为 `file` 时生效,根据文件拓展名过滤可选择文件。每一项都不能是空字符串。默认不过滤 | _string[] \| undefined_ | - |
| showmenu `v1.10.13` | 预览图片时,是否显示长按菜单 | _boolean_ | `true` |
| upload-icon | 上传区域图标,可选值见 [Icon 组件](#/icon) | _string_ | `plus` |

View File

@ -42,7 +42,7 @@ export const mediaProps = {
},
mediaType: {
type: Array,
value: ['image', 'video'],
value: ['image', 'video', 'mix'],
},
maxDuration: {
type: Number,

View File

@ -73,9 +73,10 @@ function formatVideo(
function formatMedia(res: WechatMiniprogram.ChooseMediaSuccessCallbackResult) {
return res.tempFiles.map((item) => ({
...pickExclude(item, ['fileType', 'thumbTempFilePath', 'tempFilePath']),
type: res.type,
type: item.fileType,
url: item.tempFilePath,
thumb: res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath,
thumb:
item.fileType === 'video' ? item.thumbTempFilePath : item.tempFilePath,
}));
}

View File

@ -642,12 +642,7 @@
resolved "https://registry.npmmirror.com/@babel/parser/-/parser-7.20.1.tgz#3e045a92f7b4623cafc2425eddcb8cf2e54f9cc5"
integrity sha512-hp0AYxaZJhxULfM1zyp7Wgr+pSUKBcP3M+PHnSzWGdXOzg/kHWIgiUWARvubhUKGOEw3xqY4x+lyZ9ytBVcELw==
"@babel/parser@^7.22.15":
version "7.23.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.5.tgz#37dee97c4752af148e1d38c34b856b2507660563"
integrity sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==
"@babel/parser@^7.23.3":
"@babel/parser@^7.22.15", "@babel/parser@^7.23.3":
version "7.23.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.5.tgz#37dee97c4752af148e1d38c34b856b2507660563"
integrity sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==
@ -9630,9 +9625,9 @@ minimist@^1.2.0, minimist@^1.2.5:
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
miniprogram-api-typings@^3.1.6, miniprogram-api-typings@^3.2.2:
version "3.12.1"
resolved "https://registry.yarnpkg.com/miniprogram-api-typings/-/miniprogram-api-typings-3.12.1.tgz#5547f33f850f3753fd88a6971a06aac204f578c4"
integrity sha512-ewXOEqLGIgqQSy4wbaCHq47sfDsC/hQhO9QVzTQTCKNf9x691AwADHorfCTfVLXDVkOjbbLmJ086M3Dv7hKcXw==
version "3.12.2"
resolved "https://registry.yarnpkg.com/miniprogram-api-typings/-/miniprogram-api-typings-3.12.2.tgz#88f9a43e5a7ab9162d848feee0e876f9bae52585"
integrity sha512-OJB2uVAfhycX4teG/zEVpoThushQqLOx946XACDpVc6OQydiJWjn7djVzvNCbv0VOA7sbHGPQp/RkXD9vMCDEw==
miniprogram-ci@^1.6.1:
version "1.9.5"