@tuya-miniapp/smart-ui 1.0.1 → 1.1.0-beta-1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/dist/action-sheet/index.js +4 -0
- package/dist/action-sheet/index.wxml +1 -0
- package/dist/calendar/index.js +5 -0
- package/dist/dialog/dialog.js +5 -1
- package/dist/notify/index.js +8 -0
- package/dist/notify/index.wxml +3 -2
- package/dist/notify/notify.d.ts +1 -0
- package/dist/popup/index.css +1 -1
- package/dist/popup/index.js +15 -0
- package/dist/popup/index.wxs +1 -0
- package/dist/popup/index.wxss +1 -1
- package/dist/popup/popup.wxml +2 -2
- package/dist/switch/index.js +4 -0
- package/dist/switch/index.wxml +30 -12
- package/lib/action-sheet/index.js +4 -0
- package/lib/action-sheet/index.wxml +1 -0
- package/lib/calendar/index.js +5 -0
- package/lib/dialog/dialog.js +5 -1
- package/lib/notify/index.js +8 -0
- package/lib/notify/index.wxml +3 -2
- package/lib/notify/notify.d.ts +1 -0
- package/lib/popup/index.css +1 -1
- package/lib/popup/index.js +15 -0
- package/lib/popup/index.wxs +1 -0
- package/lib/popup/index.wxss +1 -1
- package/lib/popup/popup.wxml +2 -2
- package/lib/switch/index.js +4 -0
- package/lib/switch/index.wxml +30 -12
- package/package.json +3 -1
package/README.md
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
overlay="{{ overlay }}"
|
9
9
|
custom-class="smart-action-sheet custom-class"
|
10
10
|
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
11
|
+
safe-area-inset-bottom-min="{{ safeAreaInsetBottomMin }}"
|
11
12
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
12
13
|
root-portal="{{ rootPortal }}"
|
13
14
|
bind:close="onClickOverlay"
|
package/dist/calendar/index.js
CHANGED
@@ -137,6 +137,7 @@ SmartComponent({
|
|
137
137
|
});
|
138
138
|
},
|
139
139
|
mounted() {
|
140
|
+
this.isMounted = true;
|
140
141
|
if (this.data.show || !this.data.poppable) {
|
141
142
|
this.initRect();
|
142
143
|
this.scrollIntoView();
|
@@ -148,6 +149,8 @@ SmartComponent({
|
|
148
149
|
this.scrollIntoView();
|
149
150
|
},
|
150
151
|
initRect() {
|
152
|
+
if (!this.isMounted)
|
153
|
+
return;
|
151
154
|
if (this.contentObserver != null) {
|
152
155
|
this.contentObserver.disconnect();
|
153
156
|
}
|
@@ -203,6 +206,8 @@ SmartComponent({
|
|
203
206
|
return this.limitDateRange(defaultDate);
|
204
207
|
},
|
205
208
|
scrollIntoView() {
|
209
|
+
if (!this.isMounted)
|
210
|
+
return;
|
206
211
|
requestAnimationFrame(() => {
|
207
212
|
const { currentDate, type, show, poppable, minDate, maxDate } = this.data;
|
208
213
|
if (!currentDate)
|
package/dist/dialog/dialog.js
CHANGED
@@ -42,9 +42,13 @@ const Dialog = (options) => {
|
|
42
42
|
delete options.context;
|
43
43
|
delete options.selector;
|
44
44
|
if (dialog) {
|
45
|
+
const optionsWithInputValue = Object.assign({}, options);
|
46
|
+
if (typeof options.value === 'string') {
|
47
|
+
optionsWithInputValue.inputValue = options.value;
|
48
|
+
}
|
45
49
|
dialog.setData(Object.assign({ callback: (action, instance) => {
|
46
50
|
action === 'confirm' ? resolve(instance) : reject(instance);
|
47
|
-
} },
|
51
|
+
} }, optionsWithInputValue));
|
48
52
|
wx.nextTick(() => {
|
49
53
|
dialog.setData({ show: true });
|
50
54
|
});
|
package/dist/notify/index.js
CHANGED
package/dist/notify/index.wxml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<wxs src="./index.wxs" module="computed" />
|
3
3
|
|
4
4
|
<smart-transition
|
5
|
-
name="
|
5
|
+
name="{{ transition }}"
|
6
6
|
show="{{ show }}"
|
7
7
|
custom-class="smart-notify__container"
|
8
8
|
custom-style="{{ computed.rootStyle({ zIndex, top }) }}"
|
@@ -16,6 +16,7 @@
|
|
16
16
|
wx:if="{{ safeAreaInsetTop }}"
|
17
17
|
style="height: {{ statusBarHeight }}px"
|
18
18
|
/>
|
19
|
-
<
|
19
|
+
<slot wx:if="{{ useSlot }}" />
|
20
|
+
<text wx:else>{{ message }}</text>
|
20
21
|
</view>
|
21
22
|
</smart-transition>
|
package/dist/notify/notify.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
interface NotifyOptions {
|
2
2
|
type?: 'primary' | 'success' | 'danger' | 'warning';
|
3
|
+
transition?: 'fade' | 'fade-up' | 'fade-down' | 'fade-left' | 'fade-right' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right';
|
3
4
|
color?: string;
|
4
5
|
zIndex?: number;
|
5
6
|
top?: number;
|
package/dist/popup/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
@import '../common/index.css';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--
|
1
|
+
@import '../common/index.css';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--safeTabBar,.smart-popup--top.smart-popup--safeTabBar{bottom:var(--tabbar-height,55px)}.smart-popup--safeTop{padding-top:env(safe-area-inset-top)}.smart-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,24px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.smart-popup__close-icon--top-left{left:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--top-right{right:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,12px);left:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,12px);right:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon:active{opacity:.6}.smart-scale-enter-active,.smart-scale-leave-active{transition-property:opacity,transform}.smart-scale-enter,.smart-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.smart-fade-enter-active,.smart-fade-leave-active{transition-property:opacity}.smart-fade-enter,.smart-fade-leave-to{opacity:0}.smart-center-enter-active,.smart-center-leave-active{transition-property:opacity}.smart-center-enter,.smart-center-leave-to{opacity:0}.smart-bottom-enter-active,.smart-bottom-leave-active,.smart-left-enter-active,.smart-left-leave-active,.smart-right-enter-active,.smart-right-leave-active,.smart-top-enter-active,.smart-top-leave-active{transition-property:transform}.smart-bottom-enter,.smart-bottom-leave-to{transform:translate3d(0,100%,0)}.smart-top-enter,.smart-top-leave-to{transform:translate3d(0,-100%,0)}.smart-left-enter,.smart-left-leave-to{transform:translate3d(-100%,-50%,0)}.smart-right-enter,.smart-right-leave-to{transform:translate3d(100%,-50%,0)}
|
package/dist/popup/index.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import closeIcon from '@tuya-miniapp/icons/dist/svg/Xmark';
|
2
2
|
import { SmartComponent } from '../common/component';
|
3
3
|
import { transition } from '../mixins/transition';
|
4
|
+
import { getSystemInfoSync } from '../common/utils';
|
5
|
+
const { safeArea, screenHeight, statusBarHeight } = getSystemInfoSync() || {};
|
4
6
|
SmartComponent({
|
5
7
|
classes: [
|
6
8
|
'enter-class',
|
@@ -50,6 +52,10 @@ SmartComponent({
|
|
50
52
|
type: Boolean,
|
51
53
|
value: true,
|
52
54
|
},
|
55
|
+
safeAreaInsetBottomMin: {
|
56
|
+
type: Number,
|
57
|
+
value: 0,
|
58
|
+
},
|
53
59
|
safeAreaInsetTop: {
|
54
60
|
type: Boolean,
|
55
61
|
value: false,
|
@@ -69,6 +75,15 @@ SmartComponent({
|
|
69
75
|
},
|
70
76
|
data: {
|
71
77
|
closeIcon,
|
78
|
+
bottomSafeHeight: 0,
|
79
|
+
},
|
80
|
+
mounted() {
|
81
|
+
if (!this.data.safeAreaInsetBottom)
|
82
|
+
return;
|
83
|
+
const bottomSafeHeight = screenHeight - (safeArea === null || safeArea === void 0 ? void 0 : safeArea.height) - statusBarHeight;
|
84
|
+
this.setData({
|
85
|
+
bottomSafeHeight: Math.max(bottomSafeHeight, this.data.safeAreaInsetBottomMin),
|
86
|
+
});
|
72
87
|
},
|
73
88
|
created() {
|
74
89
|
this.observeClass();
|
package/dist/popup/index.wxs
CHANGED
@@ -4,6 +4,7 @@ var style = require('../wxs/style.wxs');
|
|
4
4
|
function popupStyle(data) {
|
5
5
|
return style([
|
6
6
|
{
|
7
|
+
'margin-bottom': data.bottomSafeHeight + 'px',
|
7
8
|
'z-index': data.zIndex,
|
8
9
|
'-webkit-transition-duration': data.currentDuration + 'ms',
|
9
10
|
'transition-duration': data.currentDuration + 'ms',
|
package/dist/popup/index.wxss
CHANGED
@@ -1 +1 @@
|
|
1
|
-
@import '../common/index.wxss';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--
|
1
|
+
@import '../common/index.wxss';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--safeTabBar,.smart-popup--top.smart-popup--safeTabBar{bottom:var(--tabbar-height,55px)}.smart-popup--safeTop{padding-top:env(safe-area-inset-top)}.smart-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,24px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.smart-popup__close-icon--top-left{left:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--top-right{right:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,12px);left:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,12px);right:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon:active{opacity:.6}.smart-scale-enter-active,.smart-scale-leave-active{transition-property:opacity,transform}.smart-scale-enter,.smart-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.smart-fade-enter-active,.smart-fade-leave-active{transition-property:opacity}.smart-fade-enter,.smart-fade-leave-to{opacity:0}.smart-center-enter-active,.smart-center-leave-active{transition-property:opacity}.smart-center-enter,.smart-center-leave-to{opacity:0}.smart-bottom-enter-active,.smart-bottom-leave-active,.smart-left-enter-active,.smart-left-leave-active,.smart-right-enter-active,.smart-right-leave-active,.smart-top-enter-active,.smart-top-leave-active{transition-property:transform}.smart-bottom-enter,.smart-bottom-leave-to{transform:translate3d(0,100%,0)}.smart-top-enter,.smart-top-leave-to{transform:translate3d(0,-100%,0)}.smart-left-enter,.smart-left-leave-to{transform:translate3d(-100%,-50%,0)}.smart-right-enter,.smart-right-leave-to{transform:translate3d(100%,-50%,0)}
|
package/dist/popup/popup.wxml
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
<wxs src="./index.wxs" module="computed" />
|
3
3
|
<view
|
4
4
|
wx:if="{{ inited }}"
|
5
|
-
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round,
|
6
|
-
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}"
|
5
|
+
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"
|
6
|
+
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle, bottomSafeHeight }) }}"
|
7
7
|
bind:transitionend="onTransitionEnd"
|
8
8
|
catch:touchmove="{{ lockScroll ? 'noop' : ''}}"
|
9
9
|
>
|
package/dist/switch/index.js
CHANGED
package/dist/switch/index.wxml
CHANGED
@@ -1,16 +1,34 @@
|
|
1
1
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
2
2
|
<wxs src="./index.wxs" module="computed" />
|
3
3
|
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<smart-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
4
|
+
<block wx:if="{{stopClickPropagation}}">
|
5
|
+
<view
|
6
|
+
class="{{ utils.bem('switch', { on: checked === activeValue, disabled }) }} custom-class"
|
7
|
+
style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
|
8
|
+
catch:tap="onClick"
|
9
|
+
>
|
10
|
+
<view class="smart-switch__node node-class">
|
11
|
+
<smart-loading
|
12
|
+
wx:if="{{ loading }}"
|
13
|
+
color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
|
14
|
+
custom-class="smart-switch__loading"
|
15
|
+
/>
|
16
|
+
</view>
|
15
17
|
</view>
|
16
|
-
</
|
18
|
+
</block>
|
19
|
+
<block wx:else>
|
20
|
+
<view
|
21
|
+
class="{{ utils.bem('switch', { on: checked === activeValue, disabled }) }} custom-class"
|
22
|
+
style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
|
23
|
+
bind:tap="onClick"
|
24
|
+
>
|
25
|
+
<view class="smart-switch__node node-class">
|
26
|
+
<smart-loading
|
27
|
+
wx:if="{{ loading }}"
|
28
|
+
color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
|
29
|
+
custom-class="smart-switch__loading"
|
30
|
+
/>
|
31
|
+
</view>
|
32
|
+
</view>
|
33
|
+
</block>
|
34
|
+
|
@@ -8,6 +8,7 @@
|
|
8
8
|
overlay="{{ overlay }}"
|
9
9
|
custom-class="smart-action-sheet custom-class"
|
10
10
|
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
11
|
+
safe-area-inset-bottom-min="{{ safeAreaInsetBottomMin }}"
|
11
12
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
12
13
|
root-portal="{{ rootPortal }}"
|
13
14
|
bind:close="onClickOverlay"
|
package/lib/calendar/index.js
CHANGED
@@ -153,6 +153,7 @@ var getTime = function (date) {
|
|
153
153
|
});
|
154
154
|
},
|
155
155
|
mounted: function () {
|
156
|
+
this.isMounted = true;
|
156
157
|
if (this.data.show || !this.data.poppable) {
|
157
158
|
this.initRect();
|
158
159
|
this.scrollIntoView();
|
@@ -165,6 +166,8 @@ var getTime = function (date) {
|
|
165
166
|
},
|
166
167
|
initRect: function () {
|
167
168
|
var _this = this;
|
169
|
+
if (!this.isMounted)
|
170
|
+
return;
|
168
171
|
if (this.contentObserver != null) {
|
169
172
|
this.contentObserver.disconnect();
|
170
173
|
}
|
@@ -225,6 +228,8 @@ var getTime = function (date) {
|
|
225
228
|
},
|
226
229
|
scrollIntoView: function () {
|
227
230
|
var _this = this;
|
231
|
+
if (!this.isMounted)
|
232
|
+
return;
|
228
233
|
(0, utils_2.requestAnimationFrame)(function () {
|
229
234
|
var _a = _this.data, currentDate = _a.currentDate, type = _a.type, show = _a.show, poppable = _a.poppable, minDate = _a.minDate, maxDate = _a.maxDate;
|
230
235
|
if (!currentDate)
|
package/lib/dialog/dialog.js
CHANGED
@@ -55,9 +55,13 @@ var Dialog = function (options) {
|
|
55
55
|
delete options.context;
|
56
56
|
delete options.selector;
|
57
57
|
if (dialog) {
|
58
|
+
var optionsWithInputValue = __assign({}, options);
|
59
|
+
if (typeof options.value === 'string') {
|
60
|
+
optionsWithInputValue.inputValue = options.value;
|
61
|
+
}
|
58
62
|
dialog.setData(__assign({ callback: function (action, instance) {
|
59
63
|
action === 'confirm' ? resolve(instance) : reject(instance);
|
60
|
-
} },
|
64
|
+
} }, optionsWithInputValue));
|
61
65
|
wx.nextTick(function () {
|
62
66
|
dialog.setData({ show: true });
|
63
67
|
});
|
package/lib/notify/index.js
CHANGED
package/lib/notify/index.wxml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<wxs src="./index.wxs" module="computed" />
|
3
3
|
|
4
4
|
<smart-transition
|
5
|
-
name="
|
5
|
+
name="{{ transition }}"
|
6
6
|
show="{{ show }}"
|
7
7
|
custom-class="smart-notify__container"
|
8
8
|
custom-style="{{ computed.rootStyle({ zIndex, top }) }}"
|
@@ -16,6 +16,7 @@
|
|
16
16
|
wx:if="{{ safeAreaInsetTop }}"
|
17
17
|
style="height: {{ statusBarHeight }}px"
|
18
18
|
/>
|
19
|
-
<
|
19
|
+
<slot wx:if="{{ useSlot }}" />
|
20
|
+
<text wx:else>{{ message }}</text>
|
20
21
|
</view>
|
21
22
|
</smart-transition>
|
package/lib/notify/notify.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
interface NotifyOptions {
|
2
2
|
type?: 'primary' | 'success' | 'danger' | 'warning';
|
3
|
+
transition?: 'fade' | 'fade-up' | 'fade-down' | 'fade-left' | 'fade-right' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right';
|
3
4
|
color?: string;
|
4
5
|
zIndex?: number;
|
5
6
|
top?: number;
|
package/lib/popup/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
@import '../common/index.css';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--
|
1
|
+
@import '../common/index.css';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--safeTabBar,.smart-popup--top.smart-popup--safeTabBar{bottom:var(--tabbar-height,55px)}.smart-popup--safeTop{padding-top:env(safe-area-inset-top)}.smart-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,24px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.smart-popup__close-icon--top-left{left:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--top-right{right:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,12px);left:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,12px);right:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon:active{opacity:.6}.smart-scale-enter-active,.smart-scale-leave-active{transition-property:opacity,transform}.smart-scale-enter,.smart-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.smart-fade-enter-active,.smart-fade-leave-active{transition-property:opacity}.smart-fade-enter,.smart-fade-leave-to{opacity:0}.smart-center-enter-active,.smart-center-leave-active{transition-property:opacity}.smart-center-enter,.smart-center-leave-to{opacity:0}.smart-bottom-enter-active,.smart-bottom-leave-active,.smart-left-enter-active,.smart-left-leave-active,.smart-right-enter-active,.smart-right-leave-active,.smart-top-enter-active,.smart-top-leave-active{transition-property:transform}.smart-bottom-enter,.smart-bottom-leave-to{transform:translate3d(0,100%,0)}.smart-top-enter,.smart-top-leave-to{transform:translate3d(0,-100%,0)}.smart-left-enter,.smart-left-leave-to{transform:translate3d(-100%,-50%,0)}.smart-right-enter,.smart-right-leave-to{transform:translate3d(100%,-50%,0)}
|
package/lib/popup/index.js
CHANGED
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var Xmark_1 = __importDefault(require("@tuya-miniapp/icons/dist/svg/Xmark"));
|
7
7
|
var component_1 = require("../common/component");
|
8
8
|
var transition_1 = require("../mixins/transition");
|
9
|
+
var utils_1 = require("../common/utils");
|
10
|
+
var _a = (0, utils_1.getSystemInfoSync)() || {}, safeArea = _a.safeArea, screenHeight = _a.screenHeight, statusBarHeight = _a.statusBarHeight;
|
9
11
|
(0, component_1.SmartComponent)({
|
10
12
|
classes: [
|
11
13
|
'enter-class',
|
@@ -55,6 +57,10 @@ var transition_1 = require("../mixins/transition");
|
|
55
57
|
type: Boolean,
|
56
58
|
value: true,
|
57
59
|
},
|
60
|
+
safeAreaInsetBottomMin: {
|
61
|
+
type: Number,
|
62
|
+
value: 0,
|
63
|
+
},
|
58
64
|
safeAreaInsetTop: {
|
59
65
|
type: Boolean,
|
60
66
|
value: false,
|
@@ -74,6 +80,15 @@ var transition_1 = require("../mixins/transition");
|
|
74
80
|
},
|
75
81
|
data: {
|
76
82
|
closeIcon: Xmark_1.default,
|
83
|
+
bottomSafeHeight: 0,
|
84
|
+
},
|
85
|
+
mounted: function () {
|
86
|
+
if (!this.data.safeAreaInsetBottom)
|
87
|
+
return;
|
88
|
+
var bottomSafeHeight = screenHeight - (safeArea === null || safeArea === void 0 ? void 0 : safeArea.height) - statusBarHeight;
|
89
|
+
this.setData({
|
90
|
+
bottomSafeHeight: Math.max(bottomSafeHeight, this.data.safeAreaInsetBottomMin),
|
91
|
+
});
|
77
92
|
},
|
78
93
|
created: function () {
|
79
94
|
this.observeClass();
|
package/lib/popup/index.wxs
CHANGED
@@ -4,6 +4,7 @@ var style = require('../wxs/style.wxs');
|
|
4
4
|
function popupStyle(data) {
|
5
5
|
return style([
|
6
6
|
{
|
7
|
+
'margin-bottom': data.bottomSafeHeight + 'px',
|
7
8
|
'z-index': data.zIndex,
|
8
9
|
'-webkit-transition-duration': data.currentDuration + 'ms',
|
9
10
|
'transition-duration': data.currentDuration + 'ms',
|
package/lib/popup/index.wxss
CHANGED
@@ -1 +1 @@
|
|
1
|
-
@import '../common/index.wxss';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--
|
1
|
+
@import '../common/index.wxss';.smart-popup{-webkit-overflow-scrolling:touch;animation:ease both;background-color:var(--popup-background-color,var(--app-B4,#fff));box-sizing:border-box;max-height:100%;overflow-y:auto;position:fixed;transition-timing-function:ease}.smart-popup--center{left:50%;top:50%;transform:translate3d(-50%,-50%,0)}.smart-popup--center.smart-popup--round{border-radius:var(--popup-round-border-radius,16px)}.smart-popup--top{left:0;top:0;width:100%}.smart-popup--top.smart-popup--round{border-radius:0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--right{right:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--right.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px))}.smart-popup--bottom{bottom:0;left:0;width:100%}.smart-popup--bottom.smart-popup--round{border-radius:var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0 0}.smart-popup--left{left:0;top:50%;transform:translate3d(0,-50%,0)}.smart-popup--left.smart-popup--round{border-radius:0 var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) var(--popup-round-border-radius,var(--popup-round-border-radius,16px)) 0}.smart-popup--bottom.smart-popup--safeTabBar,.smart-popup--top.smart-popup--safeTabBar{bottom:var(--tabbar-height,55px)}.smart-popup--safeTop{padding-top:env(safe-area-inset-top)}.smart-popup__close-icon{color:var(--popup-close-icon-color,#969799);font-size:var(--popup-close-icon-size,24px);position:absolute;z-index:var(--popup-close-icon-z-index,1)}.smart-popup__close-icon--top-left{left:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--top-right{right:var(--popup-close-icon-margin,12px);top:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-left{bottom:var(--popup-close-icon-margin,12px);left:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon--bottom-right{bottom:var(--popup-close-icon-margin,12px);right:var(--popup-close-icon-margin,12px)}.smart-popup__close-icon:active{opacity:.6}.smart-scale-enter-active,.smart-scale-leave-active{transition-property:opacity,transform}.smart-scale-enter,.smart-scale-leave-to{opacity:0;transform:translate3d(-50%,-50%,0) scale(.7)}.smart-fade-enter-active,.smart-fade-leave-active{transition-property:opacity}.smart-fade-enter,.smart-fade-leave-to{opacity:0}.smart-center-enter-active,.smart-center-leave-active{transition-property:opacity}.smart-center-enter,.smart-center-leave-to{opacity:0}.smart-bottom-enter-active,.smart-bottom-leave-active,.smart-left-enter-active,.smart-left-leave-active,.smart-right-enter-active,.smart-right-leave-active,.smart-top-enter-active,.smart-top-leave-active{transition-property:transform}.smart-bottom-enter,.smart-bottom-leave-to{transform:translate3d(0,100%,0)}.smart-top-enter,.smart-top-leave-to{transform:translate3d(0,-100%,0)}.smart-left-enter,.smart-left-leave-to{transform:translate3d(-100%,-50%,0)}.smart-right-enter,.smart-right-leave-to{transform:translate3d(100%,-50%,0)}
|
package/lib/popup/popup.wxml
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
<wxs src="./index.wxs" module="computed" />
|
3
3
|
<view
|
4
4
|
wx:if="{{ inited }}"
|
5
|
-
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round,
|
6
|
-
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}"
|
5
|
+
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"
|
6
|
+
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle, bottomSafeHeight }) }}"
|
7
7
|
bind:transitionend="onTransitionEnd"
|
8
8
|
catch:touchmove="{{ lockScroll ? 'noop' : ''}}"
|
9
9
|
>
|
package/lib/switch/index.js
CHANGED
package/lib/switch/index.wxml
CHANGED
@@ -1,16 +1,34 @@
|
|
1
1
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
2
2
|
<wxs src="./index.wxs" module="computed" />
|
3
3
|
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<smart-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
4
|
+
<block wx:if="{{stopClickPropagation}}">
|
5
|
+
<view
|
6
|
+
class="{{ utils.bem('switch', { on: checked === activeValue, disabled }) }} custom-class"
|
7
|
+
style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
|
8
|
+
catch:tap="onClick"
|
9
|
+
>
|
10
|
+
<view class="smart-switch__node node-class">
|
11
|
+
<smart-loading
|
12
|
+
wx:if="{{ loading }}"
|
13
|
+
color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
|
14
|
+
custom-class="smart-switch__loading"
|
15
|
+
/>
|
16
|
+
</view>
|
15
17
|
</view>
|
16
|
-
</
|
18
|
+
</block>
|
19
|
+
<block wx:else>
|
20
|
+
<view
|
21
|
+
class="{{ utils.bem('switch', { on: checked === activeValue, disabled }) }} custom-class"
|
22
|
+
style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor, activeValue }) }}"
|
23
|
+
bind:tap="onClick"
|
24
|
+
>
|
25
|
+
<view class="smart-switch__node node-class">
|
26
|
+
<smart-loading
|
27
|
+
wx:if="{{ loading }}"
|
28
|
+
color="{{ computed.loadingColor({ checked, activeColor, inactiveColor, activeValue }) }}"
|
29
|
+
custom-class="smart-switch__loading"
|
30
|
+
/>
|
31
|
+
</view>
|
32
|
+
</view>
|
33
|
+
</block>
|
34
|
+
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tuya-miniapp/smart-ui",
|
3
|
-
"version": "1.0
|
3
|
+
"version": "1.1.0-beta-1",
|
4
4
|
"author": "MiniApp Team",
|
5
5
|
"license": "MIT",
|
6
6
|
"miniprogram": "lib",
|
@@ -38,6 +38,8 @@
|
|
38
38
|
"@babel/preset-typescript": "^7.16.0",
|
39
39
|
"@types/fs-extra": "^11.0.4",
|
40
40
|
"@types/jest": "^27.0.2",
|
41
|
+
"@vant/eslint-config": "^4.0.0",
|
42
|
+
"@vant/stylelint-config": "^1.4.2",
|
41
43
|
"fs-extra": "^11.2.0",
|
42
44
|
"gulp": "^4.0.2",
|
43
45
|
"gulp-insert": "^0.5.0",
|