@tdesign/uniapp 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +31 -1
- package/dist/action-sheet/action-sheet.vue +3 -5
- package/dist/avatar/avatar.vue +6 -6
- package/dist/avatar-group/avatar-group.vue +1 -3
- package/dist/back-top/back-top.vue +13 -15
- package/dist/badge/badge.vue +1 -3
- package/dist/button/button.vue +16 -15
- package/dist/calendar/README.en-US.md +1 -0
- package/dist/calendar/README.md +1 -0
- package/dist/calendar/calendar-header.vue +1 -3
- package/dist/calendar/calendar.vue +28 -19
- package/dist/calendar/props.ts +5 -0
- package/dist/calendar/template.vue +1 -3
- package/dist/calendar/type.ts +6 -0
- package/dist/cascader/cascader.vue +1 -3
- package/dist/cell/cell.vue +51 -35
- package/dist/cell-group/cell-group.vue +1 -3
- package/dist/check-tag/check-tag.vue +12 -15
- package/dist/checkbox/README.en-US.md +6 -6
- package/dist/checkbox/README.md +5 -5
- package/dist/checkbox/checkbox.vue +13 -15
- package/dist/checkbox/type.ts +3 -1
- package/dist/checkbox-group/type.ts +2 -0
- package/dist/col/col.vue +1 -3
- package/dist/collapse/collapse.vue +1 -3
- package/dist/collapse-panel/collapse-panel.vue +1 -3
- package/dist/color-picker/color-picker.vue +2 -4
- package/dist/color-picker/template.vue +1 -3
- package/dist/common/src/instantiationDecorator.js +6 -0
- package/dist/common/style/theme/index.css +52 -56
- package/dist/count-down/count-down.vue +2 -4
- package/dist/date-time-picker/date-time-picker.vue +1 -3
- package/dist/dialog/dialog.vue +72 -73
- package/dist/divider/divider.vue +1 -3
- package/dist/draggable/draggable.vue +1 -3
- package/dist/drawer/drawer.vue +1 -3
- package/dist/dropdown-item/dropdown-item.vue +1 -3
- package/dist/dropdown-menu/dropdown-menu.vue +12 -14
- package/dist/empty/empty.vue +1 -3
- package/dist/fab/fab.vue +1 -3
- package/dist/footer/footer.vue +1 -3
- package/dist/form/form.vue +1 -3
- package/dist/form-item/form-item.css +16 -11
- package/dist/form-item/form-item.vue +2 -7
- package/dist/grid/grid.vue +1 -3
- package/dist/grid-item/grid-item.vue +1 -3
- package/dist/guide/content.vue +1 -3
- package/dist/guide/guide.vue +3 -8
- package/dist/icon/icon.vue +1 -3
- package/dist/image/image.vue +1 -3
- package/dist/image-viewer/image-viewer.vue +27 -30
- package/dist/indexes/indexes.vue +5 -7
- package/dist/indexes-anchor/indexes-anchor.vue +1 -3
- package/dist/input/input.vue +31 -31
- package/dist/link/link.vue +25 -26
- package/dist/loading/loading.vue +2 -2
- package/dist/message/index.d.ts +1 -1
- package/dist/message/message.interface.ts +2 -1
- package/dist/message-item/message-item.vue +34 -36
- package/dist/mixins/page-scroll.js +1 -1
- package/dist/navbar/navbar.vue +46 -33
- package/dist/notice-bar/notice-bar.vue +24 -26
- package/dist/overlay/overlay.vue +5 -7
- package/dist/picker/picker.vue +3 -4
- package/dist/picker-item/picker-item.vue +2 -4
- package/dist/popover/popover.vue +1 -3
- package/dist/popup/popup.vue +1 -3
- package/dist/progress/progress.vue +1 -3
- package/dist/pull-down-refresh/pull-down-refresh.vue +13 -15
- package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +1 -3
- package/dist/qrcode/components/qrcode-status/qrcode-status.vue +1 -3
- package/dist/qrcode/qrcode.vue +1 -3
- package/dist/radio/radio.vue +17 -19
- package/dist/rate/rate.vue +1 -3
- package/dist/result/result.vue +1 -3
- package/dist/row/row.vue +1 -3
- package/dist/search/search.vue +8 -3
- package/dist/side-bar/side-bar.vue +1 -3
- package/dist/side-bar-item/side-bar-item.vue +12 -15
- package/dist/skeleton/skeleton.vue +2 -4
- package/dist/slider/slider.vue +1 -3
- package/dist/step-item/step-item.vue +1 -3
- package/dist/stepper/stepper.vue +1 -3
- package/dist/steps/steps.vue +1 -2
- package/dist/sticky/sticky.vue +1 -3
- package/dist/swipe-cell/swipe-cell.vue +2 -5
- package/dist/swiper/swiper.vue +1 -3
- package/dist/swiper-nav/swiper-nav.vue +1 -3
- package/dist/switch/switch.vue +1 -3
- package/dist/tab-bar/tab-bar.vue +2 -1
- package/dist/tab-bar-item/tab-bar-item.vue +22 -25
- package/dist/tab-panel/tab-panel.vue +1 -3
- package/dist/tabs/tabs.vue +1 -2
- package/dist/tag/tag.vue +23 -26
- package/dist/textarea/textarea.vue +1 -3
- package/dist/toast/toast.vue +12 -14
- package/dist/transition/transition.vue +1 -3
- package/dist/tree-select/tree-select.vue +6 -9
- package/dist/upload/upload.vue +1 -3
- package/dist/watermark/watermark.vue +1 -2
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ toc: false
|
|
|
5
5
|
docClass: timeline
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## 🌈 0.7.3 `2026-03-04`
|
|
9
|
+
|
|
10
|
+
### 🐞 Bug Fixes
|
|
11
|
+
|
|
12
|
+
- `Button`: 去除多余动画效果 @novlan1 ([#4305](https://github.com/Tencent/tdesign-miniprogram/pull/4305))
|
|
13
|
+
- `Dialog`: 修复确认/取消按钮不显示问题 @novlan1 ([#4305](https://github.com/Tencent/tdesign-miniprogram/pull/4305))
|
|
14
|
+
- `Theme`: 修复 `index.css` 尺寸值错误的问题 @liweijie0812 ([#4290](https://github.com/Tencent/tdesign-miniprogram/pull/4290))
|
|
15
|
+
|
|
16
|
+
## 🌈 0.7.2 `2026-02-26`
|
|
17
|
+
|
|
18
|
+
### 🚀 Features
|
|
19
|
+
|
|
20
|
+
- `Calendar`: 新增 `PopupProps` 属性,透传至 `Popup` @novlan1 ([#4264](https://github.com/Tencent/tdesign-miniprogram/pull/4264))
|
|
21
|
+
- `Navbar`: 支持监听页面变化,重新计算尺寸 @novlan1 ([#4282](https://github.com/Tencent/tdesign-miniprogram/pull/4282))
|
|
22
|
+
|
|
23
|
+
### 🐞 Bug Fixes
|
|
24
|
+
|
|
25
|
+
- `Button`: 修复 `icon.size` 不生效问题 @novlan1 ([#4264](https://github.com/Tencent/tdesign-miniprogram/pull/4264))
|
|
26
|
+
- `Form`: 修改边距错误问题 @novlan1 ([#4282](https://github.com/Tencent/tdesign-miniprogram/pull/4282))
|
|
27
|
+
- `Search`: 修复 `value` 未监听问题 @novlan1 ([#4264](https://github.com/Tencent/tdesign-miniprogram/pull/4264))
|
|
28
|
+
|
|
8
29
|
## 🌈 0.7.1 `2026-02-04`
|
|
9
30
|
|
|
10
31
|
### 🚀 Features
|
package/README.md
CHANGED
|
@@ -54,13 +54,21 @@ npm i @tdesign/uniapp
|
|
|
54
54
|
1. 在 `main.ts` 中引入样式文件
|
|
55
55
|
|
|
56
56
|
```js
|
|
57
|
+
// CLI 模式
|
|
57
58
|
import '@tdesign/uniapp/common/style/theme/index.css';
|
|
59
|
+
|
|
60
|
+
// HBuilderX 模式
|
|
61
|
+
// import './uni_modules/tdesign-uniapp/components/common/style/theme/index.css';
|
|
58
62
|
```
|
|
59
63
|
|
|
60
64
|
也可以引入 `rpx` 单位的 `less` 文件,该文件与 `tdesign-miniprogram` 完全一致。
|
|
61
65
|
|
|
62
66
|
```js
|
|
67
|
+
// CLI 模式
|
|
63
68
|
import '@tdesign/uniapp/common/style/theme/index.less';
|
|
69
|
+
|
|
70
|
+
// HBuilderX 模式
|
|
71
|
+
// import './uni_modules/tdesign-uniapp/components/common/style/theme/index.less';
|
|
64
72
|
```
|
|
65
73
|
|
|
66
74
|
2. 在文件中使用
|
|
@@ -113,7 +121,17 @@ import TLoading from '@tdesign/uniapp/loading/loading.vue';
|
|
|
113
121
|
|
|
114
122
|
安装注册 TDesign 之后,在开发项目时,可以配合插件在VSCode等主流编辑器中达到提示组件名及API的效果。
|
|
115
123
|
|
|
116
|
-
推荐安装
|
|
124
|
+
推荐安装 [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) 插件,并在项目的 `tsconfig.json` 的 `compilerOptions.types` 属性中增加 `@tdesign/uniapp/global`,即可实现提示效果。
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"compilerOptions": {
|
|
129
|
+
"types": [
|
|
130
|
+
"@tdesign/uniapp/global",
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
117
135
|
|
|
118
136
|
## 平台兼容性
|
|
119
137
|
|
|
@@ -133,6 +151,18 @@ import TLoading from '@tdesign/uniapp/loading/loading.vue';
|
|
|
133
151
|
|
|
134
152
|
详情参见[移动端组件库浏览器兼容性说明](https://github.com/Tencent/tdesign/wiki/Browser-Compatibility)
|
|
135
153
|
|
|
154
|
+
## 模板项目
|
|
155
|
+
|
|
156
|
+
我们提供了多种开箱即用的模板项目,帮助你快速开始开发。
|
|
157
|
+
|
|
158
|
+
| 模板 | 描述 | 预览 |
|
|
159
|
+
| --- | --- | --- |
|
|
160
|
+
| [TDesign UniApp Starter](https://github.com/TDesignOteam/tdesign-uniapp-starter/) | Vue3 + CLI 模式模板 - 通用类 | <img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-h5.png" height="100" /> |
|
|
161
|
+
| [TDesign UniApp Starter Apply](https://github.com/TDesignOteam/tdesign-uniapp-starter-apply/) | Vue3 + CLI 模式模板 - 活动报名 | <img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-apply-h5.png" height="100" /> |
|
|
162
|
+
| [TDesign UniApp Starter Vue3 HX](https://github.com/TDesignOteam/tdesign-uniapp-starter-vue3-hx/) | Vue3 + HBuilderX 模式模板 | <img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-vue3-hx-h5.png" height="100" /> |
|
|
163
|
+
| [TDesign UniApp Starter Vue2 CLI](https://github.com/TDesignOteam/tdesign-uniapp-starter-vue2-cli/) | Vue2 + CLI 模式模板 | <img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-vue2-cli-h5.png" height="100" /> |
|
|
164
|
+
| [TDesign UniApp Starter Vue2 HX](https://github.com/TDesignOteam/tdesign-uniapp-starter-vue2-hx/) | Vue2 + HBuilderX 模式模板 |<img src="https://cdn.uwayfly.com/tdesign-uniapp/image/tdesign-uniapp-starter-vue2-hx-h5.png" height="100" /> |
|
|
165
|
+
|
|
136
166
|
## 反馈
|
|
137
167
|
|
|
138
168
|
有任何问题,建议通过 [Github issues](https://github.com/Tencent/tdesign-miniprogram/issues) 反馈或扫码加入用户微信群。
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
:custom-navbar-height="customNavbarHeight"
|
|
12
12
|
:show-overlay="dataShowOverlay"
|
|
13
13
|
:z-index="(dataPopupProps && dataPopupProps.zIndex) || defaultPopUpzIndex"
|
|
14
|
-
:overlay-props="(dataPopupProps && dataPopupProps.overlayProps) ||
|
|
14
|
+
:overlay-props="(dataPopupProps && dataPopupProps.overlayProps) || defaultOverlayProps"
|
|
15
15
|
@visible-change="onPopupVisibleChange"
|
|
16
16
|
>
|
|
17
17
|
<view
|
|
@@ -224,7 +224,7 @@ export default uniComponent({
|
|
|
224
224
|
classPrefix: name,
|
|
225
225
|
gridThemeItems: [],
|
|
226
226
|
currentSwiperIndex: 0,
|
|
227
|
-
|
|
227
|
+
defaultOverlayProps: {},
|
|
228
228
|
defaultPopUpzIndex: 11500,
|
|
229
229
|
tools,
|
|
230
230
|
|
|
@@ -362,6 +362,4 @@ export default uniComponent({
|
|
|
362
362
|
});
|
|
363
363
|
</script>
|
|
364
364
|
|
|
365
|
-
<style scoped>
|
|
366
|
-
@import './action-sheet.css';
|
|
367
|
-
</style>
|
|
365
|
+
<style scoped src="./action-sheet.css"></style>
|
package/dist/avatar/avatar.vue
CHANGED
|
@@ -83,7 +83,7 @@ import TImage from '../image/image';
|
|
|
83
83
|
import { uniComponent } from '../common/src/index';
|
|
84
84
|
import { prefix } from '../common/config';
|
|
85
85
|
import avatarProps from './props';
|
|
86
|
-
import { setIcon, systemInfo } from '../common/utils';
|
|
86
|
+
import { setIcon, systemInfo, addUnit } from '../common/utils';
|
|
87
87
|
import tools from '../common/utils.wxs';
|
|
88
88
|
import * as utils from './computed.js';
|
|
89
89
|
import { ChildrenMixin, RELATION_MAP } from '../common/relation';
|
|
@@ -139,10 +139,12 @@ export default uniComponent({
|
|
|
139
139
|
medium: 'var(--td-avatar-icon-medium-font-size, 24px)',
|
|
140
140
|
large: 'var(--td-avatar-icon-large-font-size, 32px)',
|
|
141
141
|
};
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
return tools._style([
|
|
144
144
|
{
|
|
145
|
-
fontSize:
|
|
145
|
+
fontSize: this.iconData.size
|
|
146
|
+
? addUnit(this.iconData.size)
|
|
147
|
+
: fontSize[this.dataSize],
|
|
146
148
|
},
|
|
147
149
|
this.iconData.style || '',
|
|
148
150
|
]);
|
|
@@ -195,6 +197,4 @@ export default uniComponent({
|
|
|
195
197
|
});
|
|
196
198
|
|
|
197
199
|
</script>
|
|
198
|
-
<style scoped>
|
|
199
|
-
@import './avatar.css';
|
|
200
|
-
</style>
|
|
200
|
+
<style scoped src="./avatar.css"></style>
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
>
|
|
13
13
|
<slot name="icon" />
|
|
14
14
|
<block
|
|
15
|
-
v-if="
|
|
15
|
+
v-if="innerIcon"
|
|
16
16
|
name="icon"
|
|
17
17
|
>
|
|
18
18
|
<t-icon
|
|
19
|
-
:custom-style="
|
|
19
|
+
:custom-style="innerIcon.style || ''"
|
|
20
20
|
:t-class="tClassIcon"
|
|
21
|
-
:prefix="
|
|
22
|
-
:name="
|
|
23
|
-
:size="
|
|
24
|
-
:color="
|
|
25
|
-
:aria-hidden="!!
|
|
26
|
-
:aria-label="
|
|
27
|
-
:aria-role="
|
|
28
|
-
@click="
|
|
21
|
+
:prefix="innerIcon.prefix"
|
|
22
|
+
:name="innerIcon.name"
|
|
23
|
+
:size="innerIcon.size"
|
|
24
|
+
:color="innerIcon.color"
|
|
25
|
+
:aria-hidden="!!innerIcon.ariaHidden"
|
|
26
|
+
:aria-label="innerIcon.ariaLabel"
|
|
27
|
+
:aria-role="innerIcon.ariaRole"
|
|
28
|
+
@click="innerIcon.click || ''"
|
|
29
29
|
/>
|
|
30
30
|
</block>
|
|
31
31
|
</view>
|
|
@@ -90,7 +90,7 @@ export default uniComponent({
|
|
|
90
90
|
},
|
|
91
91
|
methods: {
|
|
92
92
|
setIcon(v) {
|
|
93
|
-
this.
|
|
93
|
+
this.innerIcon = calcIcon(v, 'backtop');
|
|
94
94
|
},
|
|
95
95
|
|
|
96
96
|
toTop() {
|
|
@@ -110,13 +110,11 @@ export default uniComponent({
|
|
|
110
110
|
return {
|
|
111
111
|
prefix,
|
|
112
112
|
classPrefix: name,
|
|
113
|
-
|
|
113
|
+
innerIcon: null,
|
|
114
114
|
hidden: true,
|
|
115
115
|
tools,
|
|
116
116
|
};
|
|
117
117
|
},
|
|
118
118
|
});
|
|
119
119
|
</script>
|
|
120
|
-
<style scoped>
|
|
121
|
-
@import './back-top.css';
|
|
122
|
-
</style>
|
|
120
|
+
<style scoped src="./back-top.css"></style>
|
package/dist/badge/badge.vue
CHANGED
package/dist/button/button.vue
CHANGED
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
@agreeprivacyauthorization="agreeprivacyauthorization"
|
|
33
33
|
>
|
|
34
34
|
<block
|
|
35
|
-
v-if="
|
|
35
|
+
v-if="innerIcon"
|
|
36
36
|
name="icon"
|
|
37
37
|
>
|
|
38
38
|
<t-icon
|
|
39
39
|
:custom-style="iconCustomStyle"
|
|
40
|
-
:t-class="classPrefix + '__icon ' + classPrefix + '__icon--' + (
|
|
41
|
-
:prefix="
|
|
42
|
-
:name="
|
|
43
|
-
:size="
|
|
44
|
-
:color="
|
|
40
|
+
:t-class="classPrefix + '__icon ' + classPrefix + '__icon--' + (innerIcon.activeIdx == innerIcon.index ? 'active ' : ' ') + tClassIcon"
|
|
41
|
+
:prefix="innerIcon.prefix"
|
|
42
|
+
:name="innerIcon.name || ''"
|
|
43
|
+
:size="innerIcon.size"
|
|
44
|
+
:color="innerIcon.color"
|
|
45
45
|
@click="'handleClose' || ''"
|
|
46
46
|
/>
|
|
47
47
|
</block>
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
/>
|
|
66
66
|
<view
|
|
67
67
|
:class="classPrefix + '__content '
|
|
68
|
-
+ ((
|
|
68
|
+
+ ((innerIcon && innerIcon.name || loading) && content ? classPrefix + '__content--has-icon' : '')"
|
|
69
69
|
>
|
|
70
70
|
<slot name="content" />
|
|
71
71
|
<block v-if="content">
|
|
@@ -82,7 +82,7 @@ import TLoading from '../loading/loading';
|
|
|
82
82
|
import { uniComponent } from '../common/src/index';
|
|
83
83
|
import { prefix } from '../common/config';
|
|
84
84
|
import props from './props';
|
|
85
|
-
import { calcIcon } from '../common/utils';
|
|
85
|
+
import { calcIcon, addUnit } from '../common/utils';
|
|
86
86
|
import tools from '../common/utils.wxs';
|
|
87
87
|
|
|
88
88
|
|
|
@@ -115,7 +115,7 @@ export default uniComponent({
|
|
|
115
115
|
prefix,
|
|
116
116
|
className: '',
|
|
117
117
|
classPrefix: name,
|
|
118
|
-
|
|
118
|
+
innerIcon: undefined,
|
|
119
119
|
};
|
|
120
120
|
},
|
|
121
121
|
computed: {
|
|
@@ -129,10 +129,12 @@ export default uniComponent({
|
|
|
129
129
|
|
|
130
130
|
return tools._style([
|
|
131
131
|
{
|
|
132
|
-
fontSize:
|
|
132
|
+
fontSize: this.innerIcon.size
|
|
133
|
+
? addUnit(this.innerIcon.size)
|
|
134
|
+
: fontSize[this.size || 'medium'],
|
|
133
135
|
borderRadius: 'var(--td-button-icon-border-radius, 4px)',
|
|
134
136
|
},
|
|
135
|
-
this.
|
|
137
|
+
this.innerIcon.style || '',
|
|
136
138
|
]);
|
|
137
139
|
},
|
|
138
140
|
loadingCustomStyle() {
|
|
@@ -146,7 +148,7 @@ export default uniComponent({
|
|
|
146
148
|
watch: {
|
|
147
149
|
icon: {
|
|
148
150
|
handler(value) {
|
|
149
|
-
this.
|
|
151
|
+
this.innerIcon = calcIcon(value, '');
|
|
150
152
|
},
|
|
151
153
|
immediate: true,
|
|
152
154
|
},
|
|
@@ -159,7 +161,7 @@ export default uniComponent({
|
|
|
159
161
|
loading: 'setClass',
|
|
160
162
|
variant: 'setClass',
|
|
161
163
|
},
|
|
162
|
-
|
|
164
|
+
created() {
|
|
163
165
|
this.setClass();
|
|
164
166
|
},
|
|
165
167
|
methods: {
|
|
@@ -214,9 +216,8 @@ export default uniComponent({
|
|
|
214
216
|
},
|
|
215
217
|
});
|
|
216
218
|
</script>
|
|
219
|
+
<style scoped src="./button.css"></style>
|
|
217
220
|
<style scoped>
|
|
218
|
-
@import './button.css';
|
|
219
|
-
|
|
220
221
|
/* #ifdef MP-QQ */
|
|
221
222
|
/* 适配 qq 小程序 */
|
|
222
223
|
.t-button--outline {
|
|
@@ -15,6 +15,7 @@ format | Function | - | Typescript: `CalendarFormatType ` `type CalendarFormatTy
|
|
|
15
15
|
locale-text | Object | - | Typescript: `CalendarLocaleText` `interface CalendarLocaleText {title?: string; weekdays?: string[]; monthTitle?: string; months?: string[]; confirm?: string;}`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/calendar/type.ts) | N
|
|
16
16
|
max-date | Number | - | \- | N
|
|
17
17
|
min-date | Number | - | \- | N
|
|
18
|
+
popup-props | Object | {} | popup properties。Typescript: `PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/calendar/type.ts) | N
|
|
18
19
|
readonly | Boolean | - | \- | N
|
|
19
20
|
switch-mode | String | none | options: none/month/year-month | N
|
|
20
21
|
title | String | - | \- | N
|
package/dist/calendar/README.md
CHANGED
|
@@ -65,6 +65,7 @@ format | Function | - | 用于格式化日期的函数。TS 类型:`CalendarFo
|
|
|
65
65
|
locale-text | Object | - | 国际化文案。TS 类型:`CalendarLocaleText` `interface CalendarLocaleText {title?: string; weekdays?: string[]; monthTitle?: string; months?: string[]; confirm?: string;}`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/calendar/type.ts) | N
|
|
66
66
|
max-date | Number | - | 最大可选的日期,不传则默认半年后 | N
|
|
67
67
|
min-date | Number | - | 最小可选的日期,不传则默认今天 | N
|
|
68
|
+
popup-props | Object | {} | 透传 Popup 组件全部属性。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/calendar/type.ts) | N
|
|
68
69
|
readonly | Boolean | - | 是否只读,只读状态下不能选择日期 | N
|
|
69
70
|
switch-mode | String | none | 切换模式。 `none` 表示平铺展示所有月份; `month` 表示支持按月切换, `year-month` 表示既按年切换,也支持按月切换。可选项:none/month/year-month | N
|
|
70
71
|
title | String | - | 标题,不传默认为“请选择日期” | N
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
<t-popup
|
|
4
4
|
v-if="usePopup"
|
|
5
5
|
:visible="visible"
|
|
6
|
-
:using-custom-navbar="usingCustomNavbar"
|
|
7
|
-
:custom-navbar-height="customNavbarHeight"
|
|
8
6
|
placement="bottom"
|
|
7
|
+
:show-overlay="isShowOverlay(popupProps && popupProps.showOverlay, true)"
|
|
8
|
+
:using-custom-navbar="usingCustomNavbar || (popupProps && popupProps.usingCustomNavbar)"
|
|
9
|
+
:custom-navbar-height="coalesce(customNavbarHeight, popupProps && popupProps.usingCustomNavbar)"
|
|
10
|
+
:z-index="(popupProps && popupProps.zIndex)"
|
|
11
|
+
:overlay-props="(popupProps && popupProps.overlayProps) || defaultOverlayProps"
|
|
9
12
|
@visible-change="onVisibleChange"
|
|
10
13
|
>
|
|
11
14
|
<CalendarTemplate
|
|
@@ -153,6 +156,8 @@ export default uniComponent({
|
|
|
153
156
|
dataVisible: this.visible,
|
|
154
157
|
dataValue: coalesce(this.value, this.defaultValue),
|
|
155
158
|
days: [],
|
|
159
|
+
|
|
160
|
+
defaultOverlayProps: {},
|
|
156
161
|
};
|
|
157
162
|
},
|
|
158
163
|
watch: {
|
|
@@ -253,6 +258,8 @@ export default uniComponent({
|
|
|
253
258
|
}
|
|
254
259
|
},
|
|
255
260
|
methods: {
|
|
261
|
+
coalesce,
|
|
262
|
+
|
|
256
263
|
getMonthTitle,
|
|
257
264
|
getDateLabel,
|
|
258
265
|
isDateSelected,
|
|
@@ -291,23 +298,23 @@ export default uniComponent({
|
|
|
291
298
|
},
|
|
292
299
|
|
|
293
300
|
updateActionButton(value) {
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
const
|
|
301
|
+
const iMin = this.getCurrentYearAndMonth(this.base.minDate);
|
|
302
|
+
const iMax = this.getCurrentYearAndMonth(this.base.maxDate);
|
|
303
|
+
const iValue = this.getCurrentYearAndMonth(value);
|
|
297
304
|
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
const
|
|
305
|
+
const iMinTimestamp = new Date(iMin.year, iMin.month, 1).getTime();
|
|
306
|
+
const iMaxTimestamp = new Date(iMax.year, iMax.month, 1).getTime();
|
|
307
|
+
const iDateValue = new Date(iValue.year, iValue.month, 1);
|
|
301
308
|
|
|
302
|
-
const
|
|
303
|
-
const
|
|
304
|
-
const
|
|
305
|
-
const
|
|
309
|
+
const iPrevYearTimestamp = getPrevYear(iDateValue).getTime();
|
|
310
|
+
const iPrevMonthTimestamp = getPrevMonth(iDateValue).getTime();
|
|
311
|
+
const iNextMonthTimestamp = getNextMonth(iDateValue).getTime();
|
|
312
|
+
const iNextYearTimestamp = getNextYear(iDateValue).getTime();
|
|
306
313
|
|
|
307
|
-
const preYearBtnDisable =
|
|
308
|
-
const prevMonthBtnDisable =
|
|
309
|
-
const nextYearBtnDisable =
|
|
310
|
-
const nextMonthBtnDisable =
|
|
314
|
+
const preYearBtnDisable = iPrevYearTimestamp < iMinTimestamp || iPrevMonthTimestamp < iMinTimestamp;
|
|
315
|
+
const prevMonthBtnDisable = iPrevMonthTimestamp < iMinTimestamp;
|
|
316
|
+
const nextYearBtnDisable = iNextMonthTimestamp > iMaxTimestamp || iNextYearTimestamp > iMaxTimestamp;
|
|
317
|
+
const nextMonthBtnDisable = iNextMonthTimestamp > iMaxTimestamp;
|
|
311
318
|
|
|
312
319
|
this.actionButtons = {
|
|
313
320
|
preYearBtnDisable,
|
|
@@ -440,12 +447,14 @@ export default uniComponent({
|
|
|
440
447
|
maxDate && (this.base.maxDate = maxDate);
|
|
441
448
|
this.calcMonths();
|
|
442
449
|
},
|
|
450
|
+
|
|
451
|
+
isShowOverlay(value, defaultValue) {
|
|
452
|
+
return tools.isBoolean(value) ? value : defaultValue;
|
|
453
|
+
},
|
|
443
454
|
},
|
|
444
455
|
});
|
|
445
456
|
</script>
|
|
446
|
-
<style scoped>
|
|
447
|
-
@import './calendar.css';
|
|
448
|
-
</style>
|
|
457
|
+
<style scoped src="./calendar.css"></style>
|
|
449
458
|
<style scoped>
|
|
450
459
|
.t-calendar-switch-mode--none > .t-calendar__months {
|
|
451
460
|
/* support mp-alipay */
|
package/dist/calendar/props.ts
CHANGED
|
@@ -39,6 +39,11 @@ export default {
|
|
|
39
39
|
minDate: {
|
|
40
40
|
type: Number,
|
|
41
41
|
},
|
|
42
|
+
/** 透传 Popup 组件全部属性 */
|
|
43
|
+
popupProps: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => ({}),
|
|
46
|
+
},
|
|
42
47
|
/** 是否只读,只读状态下不能选择日期 */
|
|
43
48
|
readonly: Boolean,
|
|
44
49
|
/** 切换模式。 `none` 表示平铺展示所有月份; `month` 表示支持按月切换, `year-month` 表示既按年切换,也支持按月切换 */
|
package/dist/calendar/type.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* */
|
|
6
6
|
|
|
7
7
|
import type { TdButtonProps as ButtonProps } from '../button/type';
|
|
8
|
+
import type { TdPopupProps as PopupProps } from '../popup/type';
|
|
8
9
|
|
|
9
10
|
export interface TdCalendarProps {
|
|
10
11
|
/**
|
|
@@ -43,6 +44,11 @@ export interface TdCalendarProps {
|
|
|
43
44
|
* 最小可选的日期,不传则默认今天
|
|
44
45
|
*/
|
|
45
46
|
minDate?: number;
|
|
47
|
+
/**
|
|
48
|
+
* 透传 Popup 组件全部属性
|
|
49
|
+
* @default {}
|
|
50
|
+
*/
|
|
51
|
+
popupProps?: PopupProps;
|
|
46
52
|
/**
|
|
47
53
|
* 是否只读,只读状态下不能选择日期
|
|
48
54
|
*/
|
package/dist/cell/cell.vue
CHANGED
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
>
|
|
14
14
|
<view :class="classPrefix + '__left ' + tClassLeft">
|
|
15
15
|
<block
|
|
16
|
-
v-if="
|
|
16
|
+
v-if="iLeftIcon"
|
|
17
17
|
name="icon"
|
|
18
18
|
>
|
|
19
19
|
<t-icon
|
|
20
20
|
:custom-style="leftIconCustomStyle"
|
|
21
21
|
:t-class="classPrefix + '__left-icon ' + tClassLeftIcon"
|
|
22
|
-
:name="
|
|
23
|
-
:size="
|
|
24
|
-
:color="
|
|
22
|
+
:name="iLeftIcon.name"
|
|
23
|
+
:size="iLeftIcon.size"
|
|
24
|
+
:color="iLeftIcon.color"
|
|
25
25
|
:aria-hidden="true"
|
|
26
|
-
:aria-label="
|
|
27
|
-
:aria-role="
|
|
26
|
+
:aria-label="iLeftIcon.ariaLabel"
|
|
27
|
+
:aria-role="iLeftIcon.ariaRole"
|
|
28
28
|
@click="'handleClose' || ''"
|
|
29
29
|
/>
|
|
30
30
|
</block>
|
|
@@ -93,31 +93,31 @@
|
|
|
93
93
|
]"
|
|
94
94
|
>
|
|
95
95
|
<t-icon
|
|
96
|
-
v-if="
|
|
96
|
+
v-if="rightArrow"
|
|
97
97
|
:custom-style="rightArrowCustomStyle"
|
|
98
98
|
:t-class=" classPrefix + '__right-icon ' + tClassRightIcon"
|
|
99
|
-
:name="
|
|
100
|
-
:size="
|
|
101
|
-
:color="
|
|
99
|
+
:name="rightArrow.name || ''"
|
|
100
|
+
:size="rightArrow.size"
|
|
101
|
+
:color="rightArrow.color"
|
|
102
102
|
:aria-hidden="true"
|
|
103
|
-
:aria-label="
|
|
104
|
-
:aria-role="
|
|
103
|
+
:aria-label="rightArrow.ariaLabel"
|
|
104
|
+
:aria-role="rightArrow.ariaRole"
|
|
105
105
|
@click="'handleClose' || ''"
|
|
106
106
|
/>
|
|
107
107
|
<block v-else>
|
|
108
108
|
<block
|
|
109
|
-
v-if="
|
|
109
|
+
v-if="iRightIcon"
|
|
110
110
|
name="icon"
|
|
111
111
|
>
|
|
112
112
|
<t-icon
|
|
113
113
|
:custom-style="rightIconCustomStyle"
|
|
114
114
|
:t-class=" classPrefix + '__right-icon ' + tClassRightIcon"
|
|
115
|
-
:name="
|
|
116
|
-
:size="
|
|
117
|
-
:color="
|
|
115
|
+
:name="iRightIcon.name"
|
|
116
|
+
:size="iRightIcon.size"
|
|
117
|
+
:color="iRightIcon.color || ''"
|
|
118
118
|
:aria-hidden="true"
|
|
119
|
-
:aria-label="
|
|
120
|
-
:aria-role="
|
|
119
|
+
:aria-label="iRightIcon.ariaLabel"
|
|
120
|
+
:aria-role="iRightIcon.ariaRole"
|
|
121
121
|
@click="'handleClose' || ''"
|
|
122
122
|
/>
|
|
123
123
|
</block>
|
|
@@ -132,7 +132,7 @@ import TImage from '../image/image';
|
|
|
132
132
|
import { uniComponent } from '../common/src/index';
|
|
133
133
|
import { prefix } from '../common/config';
|
|
134
134
|
import props from './props';
|
|
135
|
-
import { calcIcon } from '../common/utils';
|
|
135
|
+
import { calcIcon, addUnit } from '../common/utils';
|
|
136
136
|
import tools from '../common/utils.wxs';
|
|
137
137
|
|
|
138
138
|
import { ChildrenMixin, RELATION_MAP } from '../common/relation';
|
|
@@ -177,9 +177,9 @@ export default uniComponent({
|
|
|
177
177
|
return {
|
|
178
178
|
prefix,
|
|
179
179
|
classPrefix: name,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
rightArrow: null,
|
|
181
|
+
iRightIcon: null,
|
|
182
|
+
iLeftIcon: null,
|
|
183
183
|
isLastChild: false,
|
|
184
184
|
tools,
|
|
185
185
|
};
|
|
@@ -187,25 +187,43 @@ export default uniComponent({
|
|
|
187
187
|
computed: {
|
|
188
188
|
rightArrowCustomStyle() {
|
|
189
189
|
return tools._style([
|
|
190
|
-
|
|
190
|
+
{
|
|
191
|
+
color: this.rightArrow.color
|
|
192
|
+
? this.rightArrow.color
|
|
193
|
+
: COMMON_RIGHT_ICON_STYLE.color,
|
|
194
|
+
fontSize: this.rightArrow.size
|
|
195
|
+
? addUnit(this.rightArrow.size)
|
|
196
|
+
: COMMON_RIGHT_ICON_STYLE.fontSize,
|
|
197
|
+
},
|
|
191
198
|
this.rightIconStyle || '',
|
|
192
|
-
this.
|
|
199
|
+
this.rightArrow.style || '',
|
|
193
200
|
]);
|
|
194
201
|
},
|
|
195
202
|
rightIconCustomStyle() {
|
|
196
203
|
return tools._style([
|
|
197
|
-
|
|
204
|
+
{
|
|
205
|
+
color: this.iRightIcon.color
|
|
206
|
+
? this.iRightIcon.color
|
|
207
|
+
: COMMON_RIGHT_ICON_STYLE.color,
|
|
208
|
+
fontSize: this.iRightIcon.size
|
|
209
|
+
? addUnit(this.iRightIcon.size)
|
|
210
|
+
: COMMON_RIGHT_ICON_STYLE.fontSize,
|
|
211
|
+
},
|
|
198
212
|
this.rightIconStyle || '',
|
|
199
|
-
this.
|
|
213
|
+
this.iRightIcon.style || '',
|
|
200
214
|
]);
|
|
201
215
|
},
|
|
202
216
|
leftIconCustomStyle() {
|
|
203
217
|
return tools._style([
|
|
204
218
|
{
|
|
205
|
-
color:
|
|
206
|
-
|
|
219
|
+
color: this.iLeftIcon.color
|
|
220
|
+
? this.iLeftIcon.color
|
|
221
|
+
: 'var(--td-cell-left-icon-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)))',
|
|
222
|
+
fontSize: this.iLeftIcon.size
|
|
223
|
+
? addUnit(this.iLeftIcon.size)
|
|
224
|
+
: 'var(--td-cell-left-icon-font-size, 24px)',
|
|
207
225
|
},
|
|
208
|
-
this.
|
|
226
|
+
this.iLeftIcon.style || '',
|
|
209
227
|
]);
|
|
210
228
|
},
|
|
211
229
|
leftImageCustomStyle() {
|
|
@@ -218,19 +236,19 @@ export default uniComponent({
|
|
|
218
236
|
watch: {
|
|
219
237
|
leftIcon: {
|
|
220
238
|
handler(e) {
|
|
221
|
-
this.setIcon('
|
|
239
|
+
this.setIcon('iLeftIcon', e, '');
|
|
222
240
|
},
|
|
223
241
|
immediate: true,
|
|
224
242
|
},
|
|
225
243
|
rightIcon: {
|
|
226
244
|
handler(e) {
|
|
227
|
-
this.setIcon('
|
|
245
|
+
this.setIcon('iRightIcon', e, '');
|
|
228
246
|
},
|
|
229
247
|
immediate: true,
|
|
230
248
|
},
|
|
231
249
|
arrow: {
|
|
232
250
|
handler(e) {
|
|
233
|
-
this.setIcon('
|
|
251
|
+
this.setIcon('rightArrow', e, 'chevron-right');
|
|
234
252
|
},
|
|
235
253
|
immediate: true,
|
|
236
254
|
},
|
|
@@ -255,6 +273,4 @@ export default uniComponent({
|
|
|
255
273
|
},
|
|
256
274
|
});
|
|
257
275
|
</script>
|
|
258
|
-
<style scoped>
|
|
259
|
-
@import './cell.css';
|
|
260
|
-
</style>
|
|
276
|
+
<style scoped src="./cell.css"></style>
|