Skip to content

Commit 8c4da28

Browse files
authored
Fix issue 1265 (#1266)
* fix: sjs解构赋值,生成的中间变量,会导致微信端挂掉 * feat: ActionSheet新增层级属性
1 parent 83b955a commit 8c4da28

File tree

11 files changed

+98
-92
lines changed

11 files changed

+98
-92
lines changed

compiled/alipay/src/ActionSheet/index.axml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
className="ant-actionsheet-popup"
77
visible="{{visible}}"
88
position="bottom"
9+
zIndex="{{zIndex}}"
910
onClose="onClose"
1011
>
1112
<view

compiled/alipay/src/ActionSheet/index.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ toc: 'content'
2323

2424
## API
2525

26-
| 属性 | 说明 | 类型 | 默认值 |
27-
| ----------- | ------------------- | ---------------------- | ------ |
28-
| actions | 面板选项列表 | `[ActionSheetItem](#actionshetitem)`[] | [] |
29-
| cancelText | 取消按钮文字 | string | 取消 |
30-
| className | 类名 | string | - |
31-
| style | 样式 | string | - |
32-
| title | 标题 | string | - |
33-
| visible | 是否展开 | boolean | false |
34-
| onClose | 关闭时触发 | `(event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
35-
| onAction | 点击选项时触发,禁用状态下不会触发 | `(item: [ActionSheetItem](#actionsheetitem), index: number, event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
36-
26+
| 属性 | 说明 | 类型 | 默认值 |
27+
| ---------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
28+
| actions | 面板选项列表 | `[ActionSheetItem](#actionshetitem)`[] | [] |
29+
| cancelText | 取消按钮文字 | string | 取消 |
30+
| className | 类名 | string | - |
31+
| style | 样式 | string | - |
32+
| title | 标题 | string | - |
33+
| visible | 是否展开 | boolean | false |
34+
| zIndex | 弹窗层级 | number | 998 |
35+
| onClose | 关闭时触发 | `(event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
36+
| onAction | 点击选项时触发,禁用状态下不会触发 | `(item: [ActionSheetItem](#actionsheetitem), index: number, event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
3737

3838
### ActionSheetItem
3939

40-
| 属性 | 说明 | 类型 | 默认值 |
41-
| ----------- | ---------- | ------- | ------ |
42-
| icon | 图标 | - | - |
43-
| danger | 是否危险模式| boolean | false |
44-
| description | 描述 | string | - |
45-
| disabled | 是否禁用 | boolean | false |
40+
| 属性 | 说明 | 类型 | 默认值 |
41+
| ----------- | ------------ | ------- | ------ |
42+
| icon | 图标 | - | - |
43+
| danger | 是否危险模式 | boolean | false |
44+
| description | 描述 | string | - |
45+
| disabled | 是否禁用 | boolean | false |

compiled/alipay/src/ActionSheet/props.ts

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export interface IActionSheetProps extends IBaseProps {
3535
*/
3636
visible: boolean;
3737

38+
zIndex: number;
39+
3840
/**
3941
* @description 点击选项时触发,禁用或加载状态下不会触发
4042
*/

compiled/alipay/src/Calendar/helper.sjs

+17-19
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,24 @@ function getMarkCellClassName(index, items) {
5757
}
5858
function isDisplay(index, items) {
5959
// 找到需要当前月需要展示的日期最大最小索引
60-
var _items$reduce = items.reduce(function (res, item) {
61-
// !item.inThisMonth 被隐藏掉的日期
62-
// !item.isRange 不在传入范围内的日期
63-
if (!(!item.inThisMonth || !item.isRange)) {
64-
if (res.minIndex === null || res.maxIndex === null) {
65-
res.minIndex = item.index;
66-
res.maxIndex = item.index;
67-
}
68-
res.minIndex = Math.min(res.minIndex, item.index);
69-
res.maxIndex = Math.max(res.maxIndex, item.index);
60+
var _items_reduce = items.reduce(function (res, item) {
61+
// !item.inThisMonth 被隐藏掉的日期
62+
// !item.isRange 不在传入范围内的日期
63+
if (!(!item.inThisMonth || !item.isRange)) {
64+
if (res.minIndex === null || res.maxIndex === null) {
65+
res.minIndex = item.index;
66+
res.maxIndex = item.index;
7067
}
71-
return res;
72-
}, {
73-
minIndex: null,
74-
maxIndex: null
75-
}),
76-
minIndex = _items$reduce.minIndex,
77-
maxIndex = _items$reduce.maxIndex;
78-
if (maxIndex === null || maxIndex === null) return true;
79-
return index >= Math.floor(minIndex / 7) * 7 && index < Math.ceil(maxIndex / 7) * 7;
68+
res.minIndex = Math.min(res.minIndex, item.index);
69+
res.maxIndex = Math.max(res.maxIndex, item.index);
70+
}
71+
return res;
72+
}, {
73+
minIndex: null,
74+
maxIndex: null
75+
});
76+
if (_items_reduce.maxIndex === null || _items_reduce.maxIndex === null) return true;
77+
return index >= Math.floor(_items_reduce.minIndex / 7) * 7 && index < Math.ceil(_items_reduce.maxIndex / 7) * 7;
8078
}
8179
export default {
8280
getSpaceClassName: getSpaceClassName,

compiled/wechat/src/ActionSheet/index.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ toc: 'content'
2323

2424
## API
2525

26-
| 属性 | 说明 | 类型 | 默认值 |
27-
| ----------- | ------------------- | ---------------------- | ------ |
28-
| actions | 面板选项列表 | `[ActionSheetItem](#actionshetitem)`[] | [] |
29-
| cancelText | 取消按钮文字 | string | 取消 |
30-
| className | 类名 | string | - |
31-
| style | 样式 | string | - |
32-
| title | 标题 | string | - |
33-
| visible | 是否展开 | boolean | false |
34-
| onClose | 关闭时触发 | `(event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
35-
| onAction | 点击选项时触发,禁用状态下不会触发 | `(item: [ActionSheetItem](#actionsheetitem), index: number, event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
36-
26+
| 属性 | 说明 | 类型 | 默认值 |
27+
| ---------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
28+
| actions | 面板选项列表 | `[ActionSheetItem](#actionshetitem)`[] | [] |
29+
| cancelText | 取消按钮文字 | string | 取消 |
30+
| className | 类名 | string | - |
31+
| style | 样式 | string | - |
32+
| title | 标题 | string | - |
33+
| visible | 是否展开 | boolean | false |
34+
| zIndex | 弹窗层级 | number | 998 |
35+
| onClose | 关闭时触发 | `(event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
36+
| onAction | 点击选项时触发,禁用状态下不会触发 | `(item: [ActionSheetItem](#actionsheetitem), index: number, event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
3737

3838
### ActionSheetItem
3939

40-
| 属性 | 说明 | 类型 | 默认值 |
41-
| ----------- | ---------- | ------- | ------ |
42-
| icon | 图标 | - | - |
43-
| danger | 是否危险模式| boolean | false |
44-
| description | 描述 | string | - |
45-
| disabled | 是否禁用 | boolean | false |
40+
| 属性 | 说明 | 类型 | 默认值 |
41+
| ----------- | ------------ | ------- | ------ |
42+
| icon | 图标 | - | - |
43+
| danger | 是否危险模式 | boolean | false |
44+
| description | 描述 | string | - |
45+
| disabled | 是否禁用 | boolean | false |

compiled/wechat/src/ActionSheet/index.wxml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
className="ant-actionsheet-popup"
77
visible="{{visible}}"
88
position="bottom"
9+
zIndex="{{zIndex}}"
910
bind:close="onClose"
1011
>
1112
<view

compiled/wechat/src/Calendar/helper.wxs

+17-19
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,24 @@ function getMarkCellClassName(index, items) {
5757
}
5858
function isDisplay(index, items) {
5959
// 找到需要当前月需要展示的日期最大最小索引
60-
var _items$reduce = items.reduce(function (res, item) {
61-
// !item.inThisMonth 被隐藏掉的日期
62-
// !item.isRange 不在传入范围内的日期
63-
if (!(!item.inThisMonth || !item.isRange)) {
64-
if (res.minIndex === null || res.maxIndex === null) {
65-
res.minIndex = item.index;
66-
res.maxIndex = item.index;
67-
}
68-
res.minIndex = Math.min(res.minIndex, item.index);
69-
res.maxIndex = Math.max(res.maxIndex, item.index);
60+
var _items_reduce = items.reduce(function (res, item) {
61+
// !item.inThisMonth 被隐藏掉的日期
62+
// !item.isRange 不在传入范围内的日期
63+
if (!(!item.inThisMonth || !item.isRange)) {
64+
if (res.minIndex === null || res.maxIndex === null) {
65+
res.minIndex = item.index;
66+
res.maxIndex = item.index;
7067
}
71-
return res;
72-
}, {
73-
minIndex: null,
74-
maxIndex: null
75-
}),
76-
minIndex = _items$reduce.minIndex,
77-
maxIndex = _items$reduce.maxIndex;
78-
if (maxIndex === null || maxIndex === null) return true;
79-
return index >= Math.floor(minIndex / 7) * 7 && index < Math.ceil(maxIndex / 7) * 7;
68+
res.minIndex = Math.min(res.minIndex, item.index);
69+
res.maxIndex = Math.max(res.maxIndex, item.index);
70+
}
71+
return res;
72+
}, {
73+
minIndex: null,
74+
maxIndex: null
75+
});
76+
if (_items_reduce.maxIndex === null || _items_reduce.maxIndex === null) return true;
77+
return index >= Math.floor(_items_reduce.minIndex / 7) * 7 && index < Math.ceil(_items_reduce.maxIndex / 7) * 7;
8078
}
8179
module.exports = {
8280
getSpaceClassName: getSpaceClassName,

src/ActionSheet/index.axml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
className="ant-actionsheet-popup"
77
visible="{{ visible }}"
88
position="bottom"
9+
zIndex="{{ zIndex }}"
910
onClose="onClose">
1011
<view
1112
style="{{ style }}"

src/ActionSheet/index.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ toc: 'content'
2323

2424
## API
2525

26-
| 属性 | 说明 | 类型 | 默认值 |
27-
| ----------- | ------------------- | ---------------------- | ------ |
28-
| actions | 面板选项列表 | `[ActionSheetItem](#actionshetitem)`[] | [] |
29-
| cancelText | 取消按钮文字 | string | 取消 |
30-
| className | 类名 | string | - |
31-
| style | 样式 | string | - |
32-
| title | 标题 | string | - |
33-
| visible | 是否展开 | boolean | false |
34-
| onClose | 关闭时触发 | `(event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
35-
| onAction | 点击选项时触发,禁用状态下不会触发 | `(item: [ActionSheetItem](#actionsheetitem), index: number, event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
36-
26+
| 属性 | 说明 | 类型 | 默认值 |
27+
| ---------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
28+
| actions | 面板选项列表 | `[ActionSheetItem](#actionshetitem)`[] | [] |
29+
| cancelText | 取消按钮文字 | string | 取消 |
30+
| className | 类名 | string | - |
31+
| style | 样式 | string | - |
32+
| title | 标题 | string | - |
33+
| visible | 是否展开 | boolean | false |
34+
| zIndex | 弹窗层级 | number | 998 |
35+
| onClose | 关闭时触发 | `(event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
36+
| onAction | 点击选项时触发,禁用状态下不会触发 | `(item: [ActionSheetItem](#actionsheetitem), index: number, event: [Event](https://opendocs.alipay.com/mini/framework/event-object))` => void | - |
3737

3838
### ActionSheetItem
3939

40-
| 属性 | 说明 | 类型 | 默认值 |
41-
| ----------- | ---------- | ------- | ------ |
42-
| icon | 图标 | - | - |
43-
| danger | 是否危险模式| boolean | false |
44-
| description | 描述 | string | - |
45-
| disabled | 是否禁用 | boolean | false |
40+
| 属性 | 说明 | 类型 | 默认值 |
41+
| ----------- | ------------ | ------- | ------ |
42+
| icon | 图标 | - | - |
43+
| danger | 是否危险模式 | boolean | false |
44+
| description | 描述 | string | - |
45+
| disabled | 是否禁用 | boolean | false |

src/ActionSheet/props.ts

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export interface IActionSheetProps extends IBaseProps {
3535
*/
3636
visible: boolean;
3737

38+
zIndex: number;
39+
3840
/**
3941
* @description 点击选项时触发,禁用或加载状态下不会触发
4042
*/

src/Calendar/helper.sjs.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function getMarkCellClassName(index, items) {
8080

8181
function isDisplay(index, items) {
8282
// 找到需要当前月需要展示的日期最大最小索引
83-
const { minIndex, maxIndex } = items.reduce(
83+
const _items_reduce = items.reduce(
8484
(res, item) => {
8585
// !item.inThisMonth 被隐藏掉的日期
8686
// !item.isRange 不在传入范围内的日期
@@ -96,9 +96,12 @@ function isDisplay(index, items) {
9696
},
9797
{ minIndex: null, maxIndex: null }
9898
);
99-
if (maxIndex === null || maxIndex === null) return true;
99+
100+
if (_items_reduce.maxIndex === null || _items_reduce.maxIndex === null)
101+
return true;
100102
return (
101-
index >= Math.floor(minIndex / 7) * 7 && index < Math.ceil(maxIndex / 7) * 7
103+
index >= Math.floor(_items_reduce.minIndex / 7) * 7 &&
104+
index < Math.ceil(_items_reduce.maxIndex / 7) * 7
102105
);
103106
}
104107

0 commit comments

Comments
 (0)