@tuya-miniapp/smart-ui 1.3.0-beta-2 → 1.3.1-beta-2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/action-sheet/index.js +3 -7
- package/dist/battery/index.js +3 -5
- package/dist/bottom-sheet/index.css +1 -0
- package/dist/bottom-sheet/index.d.ts +1 -0
- package/dist/bottom-sheet/index.js +70 -0
- package/dist/bottom-sheet/index.json +8 -0
- package/dist/bottom-sheet/index.wxml +26 -0
- package/dist/bottom-sheet/index.wxss +1 -0
- package/dist/button/index.js +1 -0
- package/dist/button/index.wxml +1 -1
- package/dist/calendar/calendar.wxml +53 -53
- package/dist/calendar/components/header/index.css +1 -1
- package/dist/calendar/components/header/index.js +18 -0
- package/dist/calendar/components/header/index.json +4 -1
- package/dist/calendar/components/header/index.wxml +15 -4
- package/dist/calendar/components/header/index.wxss +1 -1
- package/dist/calendar/components/month/index.css +1 -1
- package/dist/calendar/components/month/index.d.ts +0 -1
- package/dist/calendar/components/month/index.js +4 -7
- package/dist/calendar/components/month/index.wxml +0 -13
- package/dist/calendar/components/month/index.wxs +13 -7
- package/dist/calendar/components/month/index.wxss +1 -1
- package/dist/calendar/components/month-list/index.css +1 -0
- package/dist/calendar/components/month-list/index.d.ts +1 -0
- package/dist/calendar/components/month-list/index.js +112 -0
- package/dist/calendar/components/month-list/index.json +7 -0
- package/dist/calendar/components/month-list/index.wxml +9 -0
- package/dist/calendar/components/month-list/index.wxss +1 -0
- package/dist/calendar/components/year-list/index.css +1 -0
- package/dist/calendar/components/year-list/index.d.ts +1 -0
- package/dist/calendar/components/year-list/index.js +100 -0
- package/dist/calendar/components/year-list/index.json +7 -0
- package/dist/calendar/components/year-list/index.wxml +9 -0
- package/dist/calendar/components/year-list/index.wxss +1 -0
- package/dist/calendar/index.css +1 -1
- package/dist/calendar/index.js +100 -51
- package/dist/calendar/index.json +3 -1
- package/dist/calendar/index.wxml +1 -1
- package/dist/calendar/index.wxs +21 -3
- package/dist/calendar/index.wxss +1 -1
- package/dist/calendar/utils.d.ts +7 -2
- package/dist/calendar/utils.js +44 -8
- package/dist/checkbox/index.css +1 -1
- package/dist/checkbox/index.js +1 -1
- package/dist/checkbox/index.wxml +2 -2
- package/dist/checkbox/index.wxss +1 -1
- package/dist/config-provider/index.wxs +2 -7
- package/dist/dropdown-item/index.css +1 -1
- package/dist/dropdown-item/index.js +10 -0
- package/dist/dropdown-item/index.wxml +9 -4
- package/dist/dropdown-item/index.wxss +1 -1
- package/dist/dropdown-menu/index.css +1 -1
- package/dist/dropdown-menu/index.js +15 -0
- package/dist/dropdown-menu/index.json +4 -1
- package/dist/dropdown-menu/index.wxml +2 -1
- package/dist/dropdown-menu/index.wxss +1 -1
- package/dist/empty/index.css +1 -1
- package/dist/empty/index.js +20 -1
- package/dist/empty/index.wxml +7 -7
- package/dist/empty/index.wxs +3 -16
- package/dist/empty/index.wxss +1 -1
- package/dist/field/index.css +1 -1
- package/dist/field/index.wxss +1 -1
- package/dist/loading/index.css +1 -1
- package/dist/loading/index.js +4 -4
- package/dist/loading/index.wxml +4 -6
- package/dist/loading/index.wxs +39 -8
- package/dist/loading/index.wxss +1 -1
- package/dist/nav-bar/index.css +1 -1
- package/dist/nav-bar/index.js +19 -1
- package/dist/nav-bar/index.wxml +16 -6
- package/dist/nav-bar/index.wxss +1 -1
- package/dist/normal-slider/index.css +1 -1
- package/dist/normal-slider/index.wxss +1 -1
- package/dist/notice-bar/index.css +1 -1
- package/dist/notice-bar/index.js +55 -2
- package/dist/notice-bar/index.wxml +28 -10
- package/dist/notice-bar/index.wxs +1 -5
- package/dist/notice-bar/index.wxss +1 -1
- package/dist/picker-column/index.js +8 -1
- package/dist/radio/index.css +1 -1
- package/dist/radio/index.js +1 -1
- package/dist/radio/index.wxml +2 -1
- package/dist/radio/index.wxss +1 -1
- package/dist/search/index.css +1 -1
- package/dist/search/index.js +14 -9
- package/dist/search/index.json +2 -1
- package/dist/search/index.wxml +7 -4
- package/dist/search/index.wxss +1 -1
- package/dist/switch/index.css +1 -1
- package/dist/switch/index.wxml +1 -0
- package/dist/switch/index.wxss +1 -1
- package/dist/tabs/index.css +1 -1
- package/dist/tabs/index.js +10 -7
- package/dist/tabs/index.wxml +1 -0
- package/dist/tabs/index.wxs +17 -0
- package/dist/tabs/index.wxss +1 -1
- package/dist/tag/index.css +1 -1
- package/dist/tag/index.wxss +1 -1
- package/dist/toast/icons.d.ts +3 -0
- package/dist/toast/icons.js +6 -0
- package/dist/toast/index.js +8 -4
- package/dist/toast/index.wxml +3 -7
- package/dist/toast/toast.d.ts +2 -0
- package/dist/toast/toast.js +2 -0
- package/dist/wxs/style.wxs +11 -5
- package/dist/wxs/utils.wxs +1 -3
- package/lib/action-sheet/index.js +3 -7
- package/lib/battery/index.js +3 -5
- package/lib/bottom-sheet/index.css +1 -0
- package/lib/bottom-sheet/index.d.ts +1 -0
- package/lib/bottom-sheet/index.js +75 -0
- package/lib/bottom-sheet/index.json +8 -0
- package/lib/bottom-sheet/index.wxml +26 -0
- package/lib/bottom-sheet/index.wxss +1 -0
- package/lib/button/index.js +1 -0
- package/lib/button/index.wxml +1 -1
- package/lib/calendar/calendar.wxml +53 -53
- package/lib/calendar/components/header/index.css +1 -1
- package/lib/calendar/components/header/index.js +21 -0
- package/lib/calendar/components/header/index.json +4 -1
- package/lib/calendar/components/header/index.wxml +15 -4
- package/lib/calendar/components/header/index.wxss +1 -1
- package/lib/calendar/components/month/index.css +1 -1
- package/lib/calendar/components/month/index.d.ts +0 -1
- package/lib/calendar/components/month/index.js +3 -6
- package/lib/calendar/components/month/index.wxml +0 -13
- package/lib/calendar/components/month/index.wxs +13 -7
- package/lib/calendar/components/month/index.wxss +1 -1
- package/lib/calendar/components/month-list/index.css +1 -0
- package/lib/calendar/components/month-list/index.d.ts +1 -0
- package/lib/calendar/components/month-list/index.js +114 -0
- package/lib/calendar/components/month-list/index.json +7 -0
- package/lib/calendar/components/month-list/index.wxml +9 -0
- package/lib/calendar/components/month-list/index.wxss +1 -0
- package/lib/calendar/components/year-list/index.css +1 -0
- package/lib/calendar/components/year-list/index.d.ts +1 -0
- package/lib/calendar/components/year-list/index.js +102 -0
- package/lib/calendar/components/year-list/index.json +7 -0
- package/lib/calendar/components/year-list/index.wxml +9 -0
- package/lib/calendar/components/year-list/index.wxss +1 -0
- package/lib/calendar/index.css +1 -1
- package/lib/calendar/index.js +99 -52
- package/lib/calendar/index.json +3 -1
- package/lib/calendar/index.wxml +1 -1
- package/lib/calendar/index.wxs +21 -3
- package/lib/calendar/index.wxss +1 -1
- package/lib/calendar/utils.d.ts +7 -2
- package/lib/calendar/utils.js +48 -10
- package/lib/checkbox/index.css +1 -1
- package/lib/checkbox/index.js +1 -1
- package/lib/checkbox/index.wxml +2 -2
- package/lib/checkbox/index.wxss +1 -1
- package/lib/config-provider/index.wxs +2 -7
- package/lib/dropdown-item/index.css +1 -1
- package/lib/dropdown-item/index.js +13 -0
- package/lib/dropdown-item/index.wxml +9 -4
- package/lib/dropdown-item/index.wxss +1 -1
- package/lib/dropdown-menu/index.css +1 -1
- package/lib/dropdown-menu/index.js +18 -0
- package/lib/dropdown-menu/index.json +4 -1
- package/lib/dropdown-menu/index.wxml +2 -1
- package/lib/dropdown-menu/index.wxss +1 -1
- package/lib/empty/index.css +1 -1
- package/lib/empty/index.js +20 -1
- package/lib/empty/index.wxml +7 -7
- package/lib/empty/index.wxs +3 -16
- package/lib/empty/index.wxss +1 -1
- package/lib/field/index.css +1 -1
- package/lib/field/index.wxss +1 -1
- package/lib/loading/index.css +1 -1
- package/lib/loading/index.js +4 -4
- package/lib/loading/index.wxml +4 -6
- package/lib/loading/index.wxs +39 -8
- package/lib/loading/index.wxss +1 -1
- package/lib/nav-bar/index.css +1 -1
- package/lib/nav-bar/index.js +19 -1
- package/lib/nav-bar/index.wxml +16 -6
- package/lib/nav-bar/index.wxss +1 -1
- package/lib/normal-slider/index.css +1 -1
- package/lib/normal-slider/index.wxss +1 -1
- package/lib/notice-bar/index.css +1 -1
- package/lib/notice-bar/index.js +58 -2
- package/lib/notice-bar/index.wxml +28 -10
- package/lib/notice-bar/index.wxs +1 -5
- package/lib/notice-bar/index.wxss +1 -1
- package/lib/picker-column/index.js +8 -1
- package/lib/radio/index.css +1 -1
- package/lib/radio/index.js +1 -1
- package/lib/radio/index.wxml +2 -1
- package/lib/radio/index.wxss +1 -1
- package/lib/search/index.css +1 -1
- package/lib/search/index.js +17 -9
- package/lib/search/index.json +2 -1
- package/lib/search/index.wxml +7 -4
- package/lib/search/index.wxss +1 -1
- package/lib/switch/index.css +1 -1
- package/lib/switch/index.wxml +1 -0
- package/lib/switch/index.wxss +1 -1
- package/lib/tabs/index.css +1 -1
- package/lib/tabs/index.js +10 -7
- package/lib/tabs/index.wxml +1 -0
- package/lib/tabs/index.wxs +17 -0
- package/lib/tabs/index.wxss +1 -1
- package/lib/tag/index.css +1 -1
- package/lib/tag/index.wxss +1 -1
- package/lib/toast/icons.d.ts +3 -0
- package/lib/toast/icons.js +12 -0
- package/lib/toast/index.js +8 -7
- package/lib/toast/index.wxml +3 -7
- package/lib/toast/toast.d.ts +2 -0
- package/lib/toast/toast.js +2 -0
- package/lib/wxs/style.wxs +11 -5
- package/lib/wxs/utils.wxs +1 -3
- package/package.json +6 -9
- package/dist/common/theme/dark.d.ts +0 -344
- package/dist/common/theme/dark.js +0 -343
- package/dist/common/theme/light.d.ts +0 -344
- package/dist/common/theme/light.js +0 -343
- package/dist/wxs/is-app-theme-var.wxs +0 -8
- package/lib/common/theme/dark.d.ts +0 -344
- package/lib/common/theme/dark.js +0 -345
- package/lib/common/theme/light.d.ts +0 -344
- package/lib/common/theme/light.js +0 -345
- package/lib/wxs/is-app-theme-var.wxs +0 -8
@@ -54,14 +54,10 @@ SmartComponent({
|
|
54
54
|
},
|
55
55
|
mounted() {
|
56
56
|
var _a;
|
57
|
-
const ty = wx;
|
58
57
|
// @ts-ignore
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
const checkMarkIconColor = this.data.activeColor || themeInfo['--app-M1'] || '#3678E3';
|
63
|
-
this.setData({ checkMarkIconColor });
|
64
|
-
}
|
58
|
+
const themeInfo = (_a = ty === null || ty === void 0 ? void 0 : ty.getThemeInfo()) !== null && _a !== void 0 ? _a : {};
|
59
|
+
const checkMarkIconColor = this.data.activeColor || themeInfo['--app-M1'] || '#3678E3';
|
60
|
+
this.setData({ checkMarkIconColor });
|
65
61
|
},
|
66
62
|
methods: {
|
67
63
|
onSelect(event) {
|
package/dist/battery/index.js
CHANGED
@@ -64,11 +64,9 @@ SmartComponent({
|
|
64
64
|
},
|
65
65
|
getBgColor() {
|
66
66
|
const WX = wx;
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
return bgColor['--app-B1-N3'];
|
71
|
-
}
|
67
|
+
const bgColor = WX.getThemeInfo();
|
68
|
+
if (bgColor && bgColor['--app-B1-N3']) {
|
69
|
+
return bgColor['--app-B1-N3'];
|
72
70
|
}
|
73
71
|
const d = wx.getSystemInfoSync();
|
74
72
|
if (d && d.theme === 'light') {
|
@@ -0,0 +1 @@
|
|
1
|
+
@import '../common/index.css';.smart-bottom-sheet{color:var(--bottom-sheet-font-color,var(--app-B4-N1,#000));max-height:var(--bottom-sheet-max-height,50%)!important;min-height:var(--bottom-sheet-min-height,auto);padding:var(--bottom-sheet-padding,0 16px);padding-bottom:env(safe-area-inset-bottom);width:var(--bottom-sheet-width,100%)!important}.smart-bottom-sheet__header{color:var(--bottom-sheet-header-color,var(--app-B4-N1,#000));font-size:var(--bottom-sheet-header-font-size,17px);font-weight:var(--bottom-sheet-header-font-weight,600);line-height:var(--bottom-sheet-header-height,56px);text-align:center}.smart-bottom-sheet__icon{margin:var(--bottom-sheet-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import xmarkIcon from '@tuya-miniapp/icons/dist/svg/Xmark';
|
2
|
+
import { SmartComponent } from '../common/component';
|
3
|
+
SmartComponent({
|
4
|
+
props: {
|
5
|
+
show: Boolean,
|
6
|
+
title: String,
|
7
|
+
iconSize: {
|
8
|
+
type: null,
|
9
|
+
value: 24,
|
10
|
+
},
|
11
|
+
round: {
|
12
|
+
type: Boolean,
|
13
|
+
value: true,
|
14
|
+
},
|
15
|
+
zIndex: {
|
16
|
+
type: Number,
|
17
|
+
value: 100,
|
18
|
+
},
|
19
|
+
overlay: {
|
20
|
+
type: Boolean,
|
21
|
+
value: true,
|
22
|
+
},
|
23
|
+
closeOnClickOverlay: {
|
24
|
+
type: Boolean,
|
25
|
+
value: true,
|
26
|
+
},
|
27
|
+
rootPortal: {
|
28
|
+
type: Boolean,
|
29
|
+
value: false,
|
30
|
+
},
|
31
|
+
},
|
32
|
+
data: {
|
33
|
+
xmarkIcon,
|
34
|
+
xmarkIconColor: '#3678E3',
|
35
|
+
},
|
36
|
+
mounted() {
|
37
|
+
var _a;
|
38
|
+
// @ts-ignore
|
39
|
+
const themeInfo = (_a = ty === null || ty === void 0 ? void 0 : ty.getThemeInfo()) !== null && _a !== void 0 ? _a : {};
|
40
|
+
const xmarkIconColor = this.data.activeColor || themeInfo['--app-B4-N3'] || 'rgba(0, 0, 0, 0.5)';
|
41
|
+
this.setData({ xmarkIconColor });
|
42
|
+
},
|
43
|
+
methods: {
|
44
|
+
onClose() {
|
45
|
+
this.$emit('close');
|
46
|
+
},
|
47
|
+
onClickOverlay() {
|
48
|
+
this.$emit('click-overlay');
|
49
|
+
this.onClose();
|
50
|
+
},
|
51
|
+
onBeforeEnter() {
|
52
|
+
this.$emit('before-enter');
|
53
|
+
},
|
54
|
+
onEnter() {
|
55
|
+
this.$emit('enter');
|
56
|
+
},
|
57
|
+
onAfterEnter() {
|
58
|
+
this.$emit('after-enter');
|
59
|
+
},
|
60
|
+
onBeforeLeave() {
|
61
|
+
this.$emit('before-leave');
|
62
|
+
},
|
63
|
+
onLeave() {
|
64
|
+
this.$emit('leave');
|
65
|
+
},
|
66
|
+
onAfterLeave() {
|
67
|
+
this.$emit('after-leave');
|
68
|
+
},
|
69
|
+
},
|
70
|
+
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<wxs src="../wxs/utils.wxs" module="utils" />
|
2
|
+
|
3
|
+
<smart-popup
|
4
|
+
show="{{ show }}"
|
5
|
+
position="bottom"
|
6
|
+
round="{{ round }}"
|
7
|
+
z-index="{{ zIndex }}"
|
8
|
+
overlay="{{ overlay }}"
|
9
|
+
custom-class="smart-bottom-sheet custom-class"
|
10
|
+
safe-area-inset-bottom="{{false}}"
|
11
|
+
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
12
|
+
root-portal="{{ rootPortal }}"
|
13
|
+
bind:close="onClickOverlay"
|
14
|
+
bind:before-enter="onBeforeEnter"
|
15
|
+
bind:enter="onEnter"
|
16
|
+
bind:after-enter="onAfterEnter"
|
17
|
+
bind:before-leave="onBeforeLeave"
|
18
|
+
bind:leave="onLeave"
|
19
|
+
bind:after-leave="onAfterLeave"
|
20
|
+
>
|
21
|
+
<view wx:if="{{ title }}" class="smart-bottom-sheet__header">
|
22
|
+
{{ title }}
|
23
|
+
<smart-icon bind:click="onClose" name="{{ xmarkIcon }}" class="smart-bottom-sheet__icon" size="{{ iconSize }}" color="{{ xmarkIconColor }}" />
|
24
|
+
</view>
|
25
|
+
<slot />
|
26
|
+
</smart-popup>
|
@@ -0,0 +1 @@
|
|
1
|
+
@import '../common/index.wxss';.smart-bottom-sheet{color:var(--bottom-sheet-font-color,var(--app-B4-N1,#000));max-height:var(--bottom-sheet-max-height,50%)!important;min-height:var(--bottom-sheet-min-height,auto);padding:var(--bottom-sheet-padding,0 16px);padding-bottom:env(safe-area-inset-bottom);width:var(--bottom-sheet-width,100%)!important}.smart-bottom-sheet__header{color:var(--bottom-sheet-header-color,var(--app-B4-N1,#000));font-size:var(--bottom-sheet-header-font-size,17px);font-weight:var(--bottom-sheet-header-font-weight,600);line-height:var(--bottom-sheet-header-height,56px);text-align:center}.smart-bottom-sheet__icon{margin:var(--bottom-sheet-icon-margin,16px 16px 0 0);position:absolute;right:0;top:0}
|
package/dist/button/index.js
CHANGED
package/dist/button/index.wxml
CHANGED
@@ -4,74 +4,74 @@
|
|
4
4
|
<header
|
5
5
|
title="{{ title }}"
|
6
6
|
showTitle="{{ showTitle }}"
|
7
|
-
subtitle="{{
|
7
|
+
subtitle="{{ mode === 'year' ? '' : mode === 'month' ? computed.formatYearTitle(currentDate, visibleIndex, locale.yearFormatter) : computed.formatMonthTitle(months[visibleIndex], subFormatter) }}"
|
8
|
+
subFormatter="{{locale.subFormatter || 'YYYY-MM'}}"
|
8
9
|
showSubtitle="{{ showSubtitle }}"
|
9
10
|
firstDayOfWeek="{{ firstDayOfWeek }}"
|
10
11
|
bind:click-subtitle="onClickSubtitle"
|
11
12
|
defaultWeeks="{{locale.shortWeekDays || ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']}}"
|
13
|
+
bind:click-prev="onPrev"
|
14
|
+
bind:click-next="onNext"
|
15
|
+
bind:click-save="onConfirm"
|
16
|
+
hideWeek="{{ mode !== 'day' }}"
|
12
17
|
>
|
13
18
|
<slot name="title" slot="title"></slot>
|
14
19
|
</header>
|
15
20
|
|
16
|
-
<
|
17
|
-
class="smart-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
<block wx:if="{{mode === 'day'}}">
|
22
|
+
<view class="smart-calendar-month_wrap" wx:for="{{ months }}" wx:key="index">
|
23
|
+
<month
|
24
|
+
id="month{{ index }}"
|
25
|
+
class="smart-calendar-month month"
|
26
|
+
wx:if="{{ computed.getVisible(visibleIndex, index) }}"
|
27
|
+
subFormatter="{{locale.subFormatter || 'YYYY-MM'}}"
|
28
|
+
rangeStart="{{locale.rangeStart || 'Start'}}"
|
29
|
+
rangeEnd="{{locale.rangeEnd || 'End'}}"
|
30
|
+
data-date="{{ item }}"
|
31
|
+
data-index="{{index}}"
|
32
|
+
date="{{ item }}"
|
33
|
+
type="{{ type }}"
|
34
|
+
color="{{ color }}"
|
35
|
+
minDate="{{ minDate }}"
|
36
|
+
maxDate="{{ maxDate }}"
|
37
|
+
showMark="{{ showMark }}"
|
38
|
+
formatter="{{ formatter }}"
|
39
|
+
rowHeight="{{ rowHeight }}"
|
40
|
+
currentDate="{{ currentDate }}"
|
41
|
+
showSubtitle="{{ showSubtitle }}"
|
42
|
+
allowSameDay="{{ allowSameDay }}"
|
43
|
+
showMonthTitle="{{ index !== 0 || !showSubtitle }}"
|
44
|
+
firstDayOfWeek="{{ firstDayOfWeek }}"
|
45
|
+
bind:click="onClickDay"
|
46
|
+
/>
|
47
|
+
</view>
|
48
|
+
</block>
|
49
|
+
|
50
|
+
<block wx:if="{{mode === 'month'}}">
|
51
|
+
<month-list
|
35
52
|
minDate="{{ minDate }}"
|
36
53
|
maxDate="{{ maxDate }}"
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
showSubtitle="{{ showSubtitle }}"
|
42
|
-
allowSameDay="{{ allowSameDay }}"
|
43
|
-
showMonthTitle="{{ index !== 0 || !showSubtitle }}"
|
44
|
-
firstDayOfWeek="{{ firstDayOfWeek }}"
|
45
|
-
dayClassMap="{{ dayClassMap }}"
|
46
|
-
bind:click="onClickDay"
|
54
|
+
monthsFormatter="{{ locale.monthsFormatter }}"
|
55
|
+
bind:click="onClickDate"
|
56
|
+
date="{{defaultDate}}"
|
57
|
+
visibleIndex="{{visibleIndex}}"
|
47
58
|
/>
|
48
|
-
</
|
59
|
+
</block>
|
49
60
|
|
50
|
-
<
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
61
|
+
<block wx:if="{{mode === 'year'}}">
|
62
|
+
<year-list
|
63
|
+
minDate="{{ minDate }}"
|
64
|
+
maxDate="{{ maxDate }}"
|
65
|
+
yearFormatter="{{ locale.yearFormatter }}"
|
66
|
+
bind:click="onClickDate"
|
67
|
+
date="{{defaultDate}}"
|
68
|
+
visibleIndex="{{visibleIndex}}"
|
69
|
+
/>
|
70
|
+
</block>
|
55
71
|
|
56
72
|
<view
|
57
73
|
class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
|
58
74
|
>
|
59
|
-
<
|
60
|
-
wx:if="{{ showConfirm }}"
|
61
|
-
round
|
62
|
-
block
|
63
|
-
type="danger"
|
64
|
-
color="{{ color }}"
|
65
|
-
custom-class="smart-calendar__confirm"
|
66
|
-
disabled="{{ computed.getButtonDisabled(type, currentDate, minRange) }}"
|
67
|
-
nativeType="text"
|
68
|
-
bind:click="onConfirm"
|
69
|
-
>
|
70
|
-
{{
|
71
|
-
computed.getButtonDisabled(type, currentDate, minRange)
|
72
|
-
? confirmDisabledText
|
73
|
-
: confirmText
|
74
|
-
}}
|
75
|
-
</smart-button>
|
75
|
+
<slot name="footer"></slot>
|
76
76
|
</view>
|
77
77
|
</view>
|
@@ -1 +1 @@
|
|
1
|
-
@import '../../../common/index.css';.smart-calendar__header{
|
1
|
+
@import '../../../common/index.css';.smart-calendar__header{flex-shrink:0}.smart-calendar__header-title{position:relative}.smart-calendar__header-title-save{color:var(--calendar-header-title-save-color,#1989fa);font-size:16px;font-weight:400;letter-spacing:0;line-height:24px;position:absolute;right:48rpx;text-align:right;top:50%;transform:translateY(-50%)}.smart-calendar__header-subtitle,.smart-calendar__header-title{font-size:16px;font-weight:var(--font-weight-bold,500);font-weight:500;height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__header-subtitle_wrap{align-items:center;display:flex;justify-content:center;position:relative}.smart-calendar__header-subtitle_left{left:52rpx}.smart-calendar__header-subtitle_left,.smart-calendar__header-subtitle_right{align-items:center;background:rgba(0,0,0,.05);border-radius:50%;display:flex;height:48rpx;justify-content:center;position:absolute;top:50%;transform:translateY(-50%);width:48rpx}.smart-calendar__header-subtitle_right{right:52rpx}.smart-calendar__header-title+.smart-calendar__header-title,.smart-calendar__header-title:empty{display:none}.smart-calendar__header-title:empty+.smart-calendar__header-title{display:block!important}.smart-calendar__weekdays{display:flex;margin-bottom:16rpx;margin-top:16rpx}.smart-calendar__weekday{color:var(--calendar-weekdays-font-color,var(--app-B4-N1,#000));flex:1;font-size:var(--calendar-weekdays-font-size,12px);font-weight:500;line-height:var(--calendar-weekdays-height,30px);opacity:.5;text-align:center}
|
@@ -1,14 +1,21 @@
|
|
1
1
|
import { SmartComponent } from '../../../common/component';
|
2
|
+
import LeftIcon from '@tuya-miniapp/icons/dist/svg/Left';
|
3
|
+
import RightIcon from '@tuya-miniapp/icons/dist/svg/Right';
|
2
4
|
SmartComponent({
|
3
5
|
props: {
|
4
6
|
title: {
|
5
7
|
type: String,
|
6
8
|
value: '日期选择',
|
7
9
|
},
|
10
|
+
rightText: {
|
11
|
+
type: String,
|
12
|
+
value: '保存',
|
13
|
+
},
|
8
14
|
subtitle: String,
|
9
15
|
showTitle: Boolean,
|
10
16
|
showSubtitle: Boolean,
|
11
17
|
defaultWeeks: Array,
|
18
|
+
hideWeek: Boolean,
|
12
19
|
firstDayOfWeek: {
|
13
20
|
type: Number,
|
14
21
|
observer: 'initWeekDay',
|
@@ -16,6 +23,8 @@ SmartComponent({
|
|
16
23
|
},
|
17
24
|
data: {
|
18
25
|
weekdays: [],
|
26
|
+
LeftIcon,
|
27
|
+
RightIcon,
|
19
28
|
},
|
20
29
|
created() {
|
21
30
|
this.initWeekDay();
|
@@ -34,5 +43,14 @@ SmartComponent({
|
|
34
43
|
onClickSubtitle(event) {
|
35
44
|
this.$emit('click-subtitle', event);
|
36
45
|
},
|
46
|
+
onPrev() {
|
47
|
+
this.$emit('click-prev');
|
48
|
+
},
|
49
|
+
onNext() {
|
50
|
+
this.$emit('click-next');
|
51
|
+
},
|
52
|
+
onSave() {
|
53
|
+
this.$emit('click-save');
|
54
|
+
},
|
37
55
|
},
|
38
56
|
});
|
@@ -1,14 +1,25 @@
|
|
1
1
|
<view class="smart-calendar__header">
|
2
2
|
<block wx:if="{{ showTitle }}">
|
3
3
|
<view class="smart-calendar__header-title"><slot name="title"></slot></view>
|
4
|
-
<view class="smart-calendar__header-title">
|
4
|
+
<view class="smart-calendar__header-title">
|
5
|
+
{{ title }}
|
6
|
+
<view class="smart-calendar__header-title-save" bind:tap=="onSave">{{ rightText }}</view>
|
7
|
+
</view>
|
5
8
|
</block>
|
6
9
|
|
7
|
-
<view
|
8
|
-
|
10
|
+
<view class="smart-calendar__header-subtitle_wrap">
|
11
|
+
<view class="smart-calendar__header-subtitle_left" bind:tap="onPrev">
|
12
|
+
<smart-icon name="{{LeftIcon}}" />
|
13
|
+
</view>
|
14
|
+
<view wx:if="{{ showSubtitle }}" class="smart-calendar__header-subtitle" bind:tap="onClickSubtitle">
|
15
|
+
{{ subtitle }}
|
16
|
+
</view>
|
17
|
+
<view class="smart-calendar__header-subtitle_right" bind:tap="onNext">
|
18
|
+
<smart-icon name="{{RightIcon}}" />
|
19
|
+
</view>
|
9
20
|
</view>
|
10
21
|
|
11
|
-
<view class="smart-calendar__weekdays">
|
22
|
+
<view class="smart-calendar__weekdays" wx:if="{{!hideWeek}}">
|
12
23
|
<view wx:for="{{ weekdays }}" wx:key="index" class="smart-calendar__weekday">
|
13
24
|
{{ item }}
|
14
25
|
</view>
|
@@ -1 +1 @@
|
|
1
|
-
@import '../../../common/index.wxss';.smart-calendar__header{
|
1
|
+
@import '../../../common/index.wxss';.smart-calendar__header{flex-shrink:0}.smart-calendar__header-title{position:relative}.smart-calendar__header-title-save{color:var(--calendar-header-title-save-color,#1989fa);font-size:16px;font-weight:400;letter-spacing:0;line-height:24px;position:absolute;right:48rpx;text-align:right;top:50%;transform:translateY(-50%)}.smart-calendar__header-subtitle,.smart-calendar__header-title{font-size:16px;font-weight:var(--font-weight-bold,500);font-weight:500;height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__header-subtitle_wrap{align-items:center;display:flex;justify-content:center;position:relative}.smart-calendar__header-subtitle_left{left:52rpx}.smart-calendar__header-subtitle_left,.smart-calendar__header-subtitle_right{align-items:center;background:rgba(0,0,0,.05);border-radius:50%;display:flex;height:48rpx;justify-content:center;position:absolute;top:50%;transform:translateY(-50%);width:48rpx}.smart-calendar__header-subtitle_right{right:52rpx}.smart-calendar__header-title+.smart-calendar__header-title,.smart-calendar__header-title:empty{display:none}.smart-calendar__header-title:empty+.smart-calendar__header-title{display:block!important}.smart-calendar__weekdays{display:flex;margin-bottom:16rpx;margin-top:16rpx}.smart-calendar__weekday{color:var(--calendar-weekdays-font-color,var(--app-B4-N1,#000));flex:1;font-size:var(--calendar-weekdays-font-size,12px);font-weight:500;line-height:var(--calendar-weekdays-height,30px);opacity:.5;text-align:center}
|
@@ -1 +1 @@
|
|
1
|
-
@import '../../../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,
|
1
|
+
@import '../../../common/index.css';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,15px);font-weight:500;height:var(--calendar-day-height,100rpx);position:relative;width:14.285%}.smart-calendar__day--end,.smart-calendar__day--multiple-middle,.smart-calendar__day--multiple-selected,.smart-calendar__day--start,.smart-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-edge-color,#fff)}.smart-calendar__day--start{border-bottom-left-radius:34rpx;border-top-left-radius:34rpx}.smart-calendar__day--end{border-bottom-right-radius:34rpx;border-top-right-radius:34rpx}.smart-calendar__day--multiple-selected,.smart-calendar__day--start-end{border-radius:4px}.smart-calendar__day--middle{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-middle-color,var(--app-B3,#fff))}.smart-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:9px}}.smart-calendar__top-info{top:6px}.smart-calendar__bottom-info{bottom:6px}.smart-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#3678e3);border-radius:50%;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,34px);width:var(--calendar-selected-day-size,34px)}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { SmartComponent } from '../../../common/component';
|
2
|
-
import { getMonthEndDay, compareDay, getPrevDay, getNextDay,
|
2
|
+
import { getMonthEndDay, compareDay, getPrevDay, getNextDay, } from '../../utils';
|
3
3
|
SmartComponent({
|
4
4
|
props: {
|
5
5
|
date: {
|
@@ -37,10 +37,6 @@ SmartComponent({
|
|
37
37
|
type: Boolean,
|
38
38
|
value: true,
|
39
39
|
},
|
40
|
-
dayClassMap: {
|
41
|
-
type: null,
|
42
|
-
observer: 'setDays',
|
43
|
-
},
|
44
40
|
subFormatter: String,
|
45
41
|
rangeStart: String,
|
46
42
|
rangeEnd: String,
|
@@ -60,7 +56,6 @@ SmartComponent({
|
|
60
56
|
}
|
61
57
|
},
|
62
58
|
setDays() {
|
63
|
-
var _a;
|
64
59
|
const days = [];
|
65
60
|
const startDate = new Date(this.data.date);
|
66
61
|
const year = startDate.getFullYear();
|
@@ -75,7 +70,6 @@ SmartComponent({
|
|
75
70
|
text: day,
|
76
71
|
bottomInfo: this.getBottomInfo(type),
|
77
72
|
};
|
78
|
-
config.className = (_a = this.data.dayClassMap[formatDate(date)]) !== null && _a !== void 0 ? _a : '';
|
79
73
|
if (this.data.formatter) {
|
80
74
|
config = this.data.formatter(config);
|
81
75
|
}
|
@@ -147,6 +141,9 @@ SmartComponent({
|
|
147
141
|
if (type === 'range') {
|
148
142
|
return this.getRangeDayType(day);
|
149
143
|
}
|
144
|
+
if (type === 'week') {
|
145
|
+
return this.getRangeDayType(day);
|
146
|
+
}
|
150
147
|
return '';
|
151
148
|
},
|
152
149
|
getBottomInfo(type) {
|
@@ -2,14 +2,7 @@
|
|
2
2
|
<wxs src="../../../wxs/utils.wxs" module="utils" />
|
3
3
|
|
4
4
|
<view class="smart-calendar__month" style="{{ computed.getMonthStyle(visible, date, rowHeight) }}">
|
5
|
-
<view wx:if="{{ showMonthTitle }}" class="smart-calendar__month-title">
|
6
|
-
{{ computed.formatMonthTitle(date, subFormatter) }}
|
7
|
-
</view>
|
8
|
-
|
9
5
|
<view wx:if="{{ visible }}" class="smart-calendar__days">
|
10
|
-
<view wx:if="{{ showMark }}" class="smart-calendar__month-mark">
|
11
|
-
{{ computed.getMark(date) }}
|
12
|
-
</view>
|
13
6
|
|
14
7
|
<view
|
15
8
|
wx:for="{{ days }}"
|
@@ -22,16 +15,10 @@
|
|
22
15
|
<view wx:if="{{ item.type === 'selected' }}" class="smart-calendar__selected-day" style="width: {{ rowHeight }}px; height: {{ rowHeight }}px; background: {{ color }}">
|
23
16
|
<view wx:if="{{ item.topInfo }}" class="smart-calendar__top-info">{{ item.topInfo }}</view>
|
24
17
|
{{ item.text }}
|
25
|
-
<view wx:if="{{ item.bottomInfo }}" class="smart-calendar__bottom-info">
|
26
|
-
{{ item.bottomInfo }}
|
27
|
-
</view>
|
28
18
|
</view>
|
29
19
|
<block wx:else>
|
30
20
|
<view wx:if="{{ item.topInfo }}" class="smart-calendar__top-info">{{ item.topInfo }}</view>
|
31
21
|
{{ item.text }}
|
32
|
-
<view wx:if="{{ item.bottomInfo }}" class="smart-calendar__bottom-info">
|
33
|
-
{{ item.bottomInfo }}
|
34
|
-
</view>
|
35
22
|
</block>
|
36
23
|
</view>
|
37
24
|
</view>
|
@@ -10,9 +10,12 @@ var ROW_HEIGHT = 64;
|
|
10
10
|
function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
|
11
11
|
var style = [];
|
12
12
|
var current = getDate(date).getDay() || 7;
|
13
|
-
var offset =
|
14
|
-
current
|
15
|
-
|
13
|
+
var offset =
|
14
|
+
current < firstDayOfWeek
|
15
|
+
? 7 - firstDayOfWeek + current
|
16
|
+
: current === 7 && firstDayOfWeek === 0
|
17
|
+
? 0
|
18
|
+
: current - firstDayOfWeek;
|
16
19
|
|
17
20
|
if (index === 0) {
|
18
21
|
style.push(['margin-left', (100 * offset) / 7 + '%']);
|
@@ -32,7 +35,7 @@ function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
|
|
32
35
|
) {
|
33
36
|
style.push(['background', color]);
|
34
37
|
} else if (type === 'middle') {
|
35
|
-
style.push(['
|
38
|
+
style.push(['background', color]);
|
36
39
|
}
|
37
40
|
}
|
38
41
|
|
@@ -43,10 +46,13 @@ function getDayStyle(type, index, date, rowHeight, color, firstDayOfWeek) {
|
|
43
46
|
.join(';');
|
44
47
|
}
|
45
48
|
|
46
|
-
function formatMonthTitle(date, formatter =
|
49
|
+
function formatMonthTitle(date, formatter = 'YYYY-MM') {
|
47
50
|
date = getDate(date);
|
48
51
|
const year = date.getFullYear();
|
49
|
-
const month =
|
52
|
+
const month =
|
53
|
+
date.getMonth() + 1 < 10
|
54
|
+
? `0${date.getMonth() + 1}`
|
55
|
+
: date.getMonth() + 1 + '';
|
50
56
|
return formatter.replace('YYYY', year + '').replace('MM', month);
|
51
57
|
}
|
52
58
|
|
@@ -69,5 +75,5 @@ module.exports = {
|
|
69
75
|
getMark: getMark,
|
70
76
|
getDayStyle: getDayStyle,
|
71
77
|
formatMonthTitle: formatMonthTitle,
|
72
|
-
getMonthStyle: getMonthStyle
|
78
|
+
getMonthStyle: getMonthStyle,
|
73
79
|
};
|
@@ -1 +1 @@
|
|
1
|
-
@import '../../../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,
|
1
|
+
@import '../../../common/index.wxss';.smart-calendar{background-color:var(--calendar-background-color,var(--app-B6,#fff));display:flex;flex-direction:column;height:100%}.smart-calendar__month-title{font-size:var(--calendar-month-title-font-size,14px);font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.smart-calendar__days{display:flex;flex-wrap:wrap;position:relative;-webkit-user-select:none;user-select:none}.smart-calendar__month-mark{color:var(--calendar-month-mark-color,hsla(210,6%,87%,.6));font-size:var(--calendar-month-mark-font-size,160px);left:50%;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:0}.smart-calendar__day,.smart-calendar__selected-day{align-items:center;display:flex;justify-content:center;text-align:center}.smart-calendar__day{font-size:var(--calendar-day-font-size,15px);font-weight:500;height:var(--calendar-day-height,100rpx);position:relative;width:14.285%}.smart-calendar__day--end,.smart-calendar__day--multiple-middle,.smart-calendar__day--multiple-selected,.smart-calendar__day--start,.smart-calendar__day--start-end{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-edge-color,#fff)}.smart-calendar__day--start{border-bottom-left-radius:34rpx;border-top-left-radius:34rpx}.smart-calendar__day--end{border-bottom-right-radius:34rpx;border-top-right-radius:34rpx}.smart-calendar__day--multiple-selected,.smart-calendar__day--start-end{border-radius:4px}.smart-calendar__day--middle{background-color:var(--calendar-range-edge-background-color,#3678e3);color:var(--calendar-range-middle-color,var(--app-B3,#fff))}.smart-calendar__day--disabled{color:var(--calendar-day-disabled-color,#c8c9cc);cursor:default}.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:var(--calendar-info-font-size,10px);left:0;line-height:var(--calendar-info-line-height,14px);position:absolute;right:0}@media (max-width:350px){.smart-calendar__bottom-info,.smart-calendar__top-info{font-size:9px}}.smart-calendar__top-info{top:6px}.smart-calendar__bottom-info{bottom:6px}.smart-calendar__selected-day{background-color:var(--calendar-selected-day-background-color,#3678e3);border-radius:50%;color:var(--calendar-selected-day-color,#fff);height:var(--calendar-selected-day-size,34px);width:var(--calendar-selected-day-size,34px)}
|
@@ -0,0 +1 @@
|
|
1
|
+
@import '../../../common/index.css';.item{border-radius:50%;color:rgba(0,0,0,.9);font-size:15px;font-weight:500;line-height:104rpx;text-align:center}.item,.item_active{height:104rpx;width:104rpx}.item_active{background:#3678e3;color:#fff}.item_disabled{opacity:.5}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|