@tuya-miniapp/smart-ui 2.3.0-beta-8 → 2.3.0-beta-10
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/dist/circle/index.js +54 -9
- package/dist/circle/index.wxml +9 -1
- package/dist/common/appLog.js +6 -6
- package/dist/common/utils.d.ts +1 -2
- package/dist/common/utils.js +6 -3
- package/dist/datetime-picker/index.js +5 -2
- package/dist/dialog/dialog.js +1 -0
- package/dist/dialog/index.js +7 -0
- package/dist/dialog/index.wxml +2 -0
- package/dist/mixins/transition.js +79 -77
- package/dist/popover/index.css +1 -1
- package/dist/popover/index.js +24 -10
- package/dist/popover/index.json +0 -1
- package/dist/popover/index.wxml +5 -7
- package/dist/popover/index.wxss +1 -1
- package/dist/popup/popup.wxml +0 -1
- package/dist/transition/index.wxml +0 -1
- package/lib/circle/index.js +56 -9
- package/lib/circle/index.wxml +9 -1
- package/lib/common/appLog.js +6 -6
- package/lib/common/utils.d.ts +1 -2
- package/lib/common/utils.js +6 -3
- package/lib/datetime-picker/index.js +5 -2
- package/lib/dialog/dialog.js +1 -0
- package/lib/dialog/index.js +7 -0
- package/lib/dialog/index.wxml +2 -0
- package/lib/mixins/transition.js +150 -88
- package/lib/popover/index.css +1 -1
- package/lib/popover/index.js +25 -10
- package/lib/popover/index.json +0 -1
- package/lib/popover/index.wxml +5 -7
- package/lib/popover/index.wxss +1 -1
- package/lib/popup/popup.wxml +0 -1
- package/lib/transition/index.wxml +0 -1
- package/package.json +1 -1
package/dist/circle/index.js
CHANGED
@@ -9,13 +9,12 @@ function percentToDecimal(percent) {
|
|
9
9
|
percent = percent.replace('%', '');
|
10
10
|
return percent / 100;
|
11
11
|
}
|
12
|
+
const idListRef = {
|
13
|
+
value: [],
|
14
|
+
};
|
12
15
|
SmartComponent({
|
13
16
|
props: {
|
14
17
|
className: String,
|
15
|
-
canvasId: {
|
16
|
-
type: String,
|
17
|
-
value: 'circle_' + Date.now(),
|
18
|
-
},
|
19
18
|
customStyle: String,
|
20
19
|
size: {
|
21
20
|
type: String,
|
@@ -44,7 +43,9 @@ SmartComponent({
|
|
44
43
|
type: Number,
|
45
44
|
value: 0,
|
46
45
|
observer(val) {
|
47
|
-
this.
|
46
|
+
if (this.data.canvasId) {
|
47
|
+
this.render(val, this.data.canvasId);
|
48
|
+
}
|
48
49
|
},
|
49
50
|
},
|
50
51
|
mode: {
|
@@ -57,7 +58,44 @@ SmartComponent({
|
|
57
58
|
value: true,
|
58
59
|
},
|
59
60
|
},
|
61
|
+
data: {
|
62
|
+
canvasId: '',
|
63
|
+
dpr: 1,
|
64
|
+
},
|
65
|
+
created() {
|
66
|
+
this.initId();
|
67
|
+
this.initRate();
|
68
|
+
},
|
69
|
+
mounted() {
|
70
|
+
this.render(this.data.percent, this.data.canvasId);
|
71
|
+
},
|
72
|
+
destroyed() {
|
73
|
+
idListRef.value = idListRef.value.filter(id => id !== this.data.canvasId);
|
74
|
+
},
|
60
75
|
methods: {
|
76
|
+
initId() {
|
77
|
+
if (this.data.canvasId)
|
78
|
+
return;
|
79
|
+
const id = `smart-ui-circle_${String(+new Date()).slice(-4)}_${String(Math.random()).slice(-2)}`;
|
80
|
+
if (idListRef.value.includes(id)) {
|
81
|
+
this.initId();
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
this.setData({
|
85
|
+
canvasId: id,
|
86
|
+
});
|
87
|
+
idListRef.value.push(id);
|
88
|
+
},
|
89
|
+
initRate() {
|
90
|
+
wx.getSystemInfo({
|
91
|
+
success: res => {
|
92
|
+
const dpr = res.pixelRatio; // 获取设备像素比
|
93
|
+
this.setData({
|
94
|
+
dpr: dpr,
|
95
|
+
});
|
96
|
+
},
|
97
|
+
});
|
98
|
+
},
|
61
99
|
renderAll(canvas, ctx, progress, ops = {
|
62
100
|
lineCap: 'round',
|
63
101
|
}) {
|
@@ -97,6 +135,7 @@ SmartComponent({
|
|
97
135
|
}
|
98
136
|
ctx.setLineCap(ops.lineCap); // 设置圆角效果
|
99
137
|
ctx.stroke();
|
138
|
+
ctx.scale(canvas.dpr, canvas.dpr);
|
100
139
|
ctx.draw();
|
101
140
|
}
|
102
141
|
// 示例:绘制不同的进度条
|
@@ -141,6 +180,7 @@ SmartComponent({
|
|
141
180
|
}
|
142
181
|
ctx.setLineCap(ops.lineCap); // 设置圆角效果
|
143
182
|
ctx.stroke();
|
183
|
+
ctx.scale(canvas.dpr, canvas.dpr);
|
144
184
|
ctx.draw();
|
145
185
|
}
|
146
186
|
// 示例:绘制不同的进度条
|
@@ -196,24 +236,29 @@ SmartComponent({
|
|
196
236
|
}
|
197
237
|
ctx.setLineCap(ops.lineCap); // 设置圆角效果
|
198
238
|
ctx.stroke();
|
239
|
+
ctx.scale(canvas.dpr, canvas.dpr);
|
199
240
|
ctx.draw();
|
200
241
|
}
|
201
242
|
// 示例:绘制不同的进度条
|
202
243
|
drawProgressBar(progress, canvas.fillColor); // 25%的蓝色进度条
|
203
244
|
},
|
204
|
-
render(val) {
|
245
|
+
render(val, canvasId) {
|
205
246
|
// @ts-ignore
|
206
|
-
const context = ty.createCanvasContext(
|
247
|
+
const context = ty.createCanvasContext(canvasId);
|
207
248
|
const sizeVal = this.parseSize();
|
208
249
|
const params = {
|
209
|
-
|
210
|
-
|
250
|
+
canvasWidth: +sizeVal,
|
251
|
+
canvasHeight: +sizeVal,
|
252
|
+
width: +sizeVal,
|
253
|
+
height: +sizeVal,
|
211
254
|
lineWidth: this.data.trackWidth,
|
212
255
|
trackColor: this.data.trackColor,
|
213
256
|
fillColor: this.data.fillColor,
|
214
257
|
fillColorStops: this.data.fillColorStops,
|
215
258
|
maskColor: this.data.maskColor,
|
259
|
+
dpr: this.data.dpr,
|
216
260
|
};
|
261
|
+
this.setData(params);
|
217
262
|
if (this.data.mode === 'basic') {
|
218
263
|
this.renderAll(params, context, val / 100, this.data.round ? { lineCap: 'round' } : { lineCap: '' });
|
219
264
|
}
|
package/dist/circle/index.wxml
CHANGED
@@ -1 +1,9 @@
|
|
1
|
-
<canvas
|
1
|
+
<canvas
|
2
|
+
class="smart-progress-circle"
|
3
|
+
type="2d"
|
4
|
+
wx:if="{{canvasId}}"
|
5
|
+
width="{{ canvasWidth * dpr }}"
|
6
|
+
height="{{ canvasHeight * dpr }}"
|
7
|
+
canvas-id="{{canvasId}}"
|
8
|
+
style="width: {{width}}px; height:{{height}}px;"
|
9
|
+
></canvas>
|
package/dist/common/appLog.js
CHANGED
@@ -13,7 +13,7 @@ export const init = (tag) => {
|
|
13
13
|
}
|
14
14
|
// @ts-ignore
|
15
15
|
if (!ty.getLogManager) {
|
16
|
-
console.warn('不支持ty.getLogManager');
|
16
|
+
// console.warn('不支持ty.getLogManager');
|
17
17
|
return null;
|
18
18
|
}
|
19
19
|
// @ts-ignore
|
@@ -39,7 +39,7 @@ export const info = (data, devId) => {
|
|
39
39
|
// console.log('success ty.Log', res);
|
40
40
|
},
|
41
41
|
failure(err) {
|
42
|
-
console.log('fail ty.Log', err);
|
42
|
+
// console.log('fail ty.Log', err);
|
43
43
|
},
|
44
44
|
});
|
45
45
|
};
|
@@ -57,10 +57,10 @@ export const warn = (data, devId) => {
|
|
57
57
|
Log.debug({
|
58
58
|
message: data,
|
59
59
|
success(res) {
|
60
|
-
console.log('success ty.debug', res);
|
60
|
+
// console.log('success ty.debug', res);
|
61
61
|
},
|
62
62
|
failure(err) {
|
63
|
-
console.log('fail ty.debug', err);
|
63
|
+
// console.log('fail ty.debug', err);
|
64
64
|
},
|
65
65
|
});
|
66
66
|
};
|
@@ -91,10 +91,10 @@ export const error = (data, devId) => {
|
|
91
91
|
Log.error({
|
92
92
|
message: _data,
|
93
93
|
success(res) {
|
94
|
-
console.log('success ty.error', res);
|
94
|
+
// console.log('success ty.error', res);
|
95
95
|
},
|
96
96
|
failure(err) {
|
97
|
-
console.log('fail ty.error', err);
|
97
|
+
// console.log('fail ty.error', err);
|
98
98
|
},
|
99
99
|
});
|
100
100
|
};
|
package/dist/common/utils.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
/// <reference types="miniprogram-api-typings" />
|
3
2
|
/// <reference types="miniprogram-api-typings" />
|
4
3
|
/// <reference types="miniprogram-api-typings" />
|
@@ -8,7 +7,7 @@ export { getSystemInfoSync } from './version';
|
|
8
7
|
export declare function range(num: number, min: number, max: number): number;
|
9
8
|
export declare function nextTick(cb: (...args: any[]) => void): void;
|
10
9
|
export declare function addUnit(value?: string | number): string | undefined;
|
11
|
-
export declare function requestAnimationFrame(cb
|
10
|
+
export declare function requestAnimationFrame(cb?: () => void): Promise<void>;
|
12
11
|
export declare function pickExclude(obj: unknown, keys: string[]): {};
|
13
12
|
export declare function getRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>;
|
14
13
|
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
|
package/dist/common/utils.js
CHANGED
@@ -23,9 +23,12 @@ export function addUnit(value) {
|
|
23
23
|
return isNumber(value) ? `${value}px` : value;
|
24
24
|
}
|
25
25
|
export function requestAnimationFrame(cb) {
|
26
|
-
return
|
27
|
-
|
28
|
-
|
26
|
+
return new Promise(resolve => {
|
27
|
+
setTimeout(() => {
|
28
|
+
cb === null || cb === void 0 ? void 0 : cb();
|
29
|
+
resolve();
|
30
|
+
}, 1000 / 30);
|
31
|
+
});
|
29
32
|
}
|
30
33
|
export function pickExclude(obj, keys) {
|
31
34
|
if (!isPlainObject(obj)) {
|
@@ -114,6 +114,9 @@ SmartComponent({
|
|
114
114
|
},
|
115
115
|
formatterFunc(type, value, data) {
|
116
116
|
var _a, _b;
|
117
|
+
if (type === 'part') {
|
118
|
+
return value === 0 ? data.amText : data.pmText;
|
119
|
+
}
|
117
120
|
const { formatterMap, formatter = defaultFormatter } = (_a = this === null || this === void 0 ? void 0 : this.data) !== null && _a !== void 0 ? _a : data;
|
118
121
|
const mapDetail = formatterMap === null || formatterMap === void 0 ? void 0 : formatterMap[type];
|
119
122
|
if (typeof mapDetail === 'string') {
|
@@ -339,8 +342,8 @@ SmartComponent({
|
|
339
342
|
part,
|
340
343
|
});
|
341
344
|
values = [
|
342
|
-
part,
|
343
|
-
formatter('hour', part ? (!hour ? 12 : hour - 12) : hour, this.data),
|
345
|
+
formatter('part', part, this.data),
|
346
|
+
formatter('hour', part ? (!hour ? '12' : (hour - 12).toString().padStart(2, '0')) : hour, this.data),
|
344
347
|
formatter('minute', minute, this.data),
|
345
348
|
];
|
346
349
|
}
|
package/dist/dialog/dialog.js
CHANGED
package/dist/dialog/index.js
CHANGED
@@ -191,5 +191,12 @@ SmartComponent({
|
|
191
191
|
callback(actionType, this);
|
192
192
|
}
|
193
193
|
},
|
194
|
+
// 兜底防止 通过api方式打开组件失败 导致队列没有清除
|
195
|
+
onPopUpError() {
|
196
|
+
const { callback, actionType } = this.data;
|
197
|
+
if (callback) {
|
198
|
+
callback(actionType, this);
|
199
|
+
}
|
200
|
+
},
|
194
201
|
},
|
195
202
|
});
|
package/dist/dialog/index.wxml
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
1
10
|
// @ts-nocheck
|
2
|
-
import appLog from '../common/appLog';
|
3
11
|
import { requestAnimationFrame } from '../common/utils';
|
4
12
|
import { isObj } from '../common/validator';
|
5
13
|
const getClassNames = (name) => ({
|
@@ -32,6 +40,8 @@ export function transition(showDefaultValue) {
|
|
32
40
|
type: '',
|
33
41
|
inited: false,
|
34
42
|
display: false,
|
43
|
+
animating: false,
|
44
|
+
status: '',
|
35
45
|
},
|
36
46
|
ready() {
|
37
47
|
if (this.data.show === true) {
|
@@ -40,110 +50,102 @@ export function transition(showDefaultValue) {
|
|
40
50
|
},
|
41
51
|
methods: {
|
42
52
|
observeShow(value, old) {
|
43
|
-
appLog.info(`transition component observeShow value: ${value};old: ${old}`);
|
44
53
|
if (value === old) {
|
45
54
|
return;
|
46
55
|
}
|
47
56
|
value ? this.enter() : this.leave();
|
48
57
|
},
|
49
58
|
enter() {
|
50
|
-
if (this.enterFinishedPromise)
|
59
|
+
if (this.enterFinishedPromise || this.data.animating)
|
51
60
|
return;
|
52
|
-
|
53
|
-
|
61
|
+
this.setData({
|
62
|
+
animating: true,
|
63
|
+
status: 'enter',
|
64
|
+
});
|
65
|
+
// eslint-disable-next-line no-async-promise-executor
|
66
|
+
this.enterFinishedPromise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
54
67
|
const { duration, name } = this.data;
|
55
68
|
const classNames = getClassNames(name);
|
56
69
|
const currentDuration = isObj(duration) ? duration.enter : duration;
|
57
|
-
if (this.status === 'enter') {
|
58
|
-
return;
|
59
|
-
}
|
60
|
-
this.status = 'enter';
|
61
70
|
this.$emit('before-enter');
|
62
|
-
requestAnimationFrame(
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
71
|
+
yield requestAnimationFrame();
|
72
|
+
this.$emit('enter');
|
73
|
+
this.setData({
|
74
|
+
inited: true,
|
75
|
+
display: true,
|
76
|
+
classes: classNames.enter,
|
77
|
+
currentDuration,
|
78
|
+
});
|
79
|
+
yield requestAnimationFrame();
|
80
|
+
this.transitionEnded = false;
|
81
|
+
this.setData({ classes: classNames['enter-to'] });
|
82
|
+
clearTimeout(this.timer);
|
83
|
+
this.timer = setTimeout(() => {
|
84
|
+
this.$emit(`after-enter`);
|
67
85
|
this.setData({
|
68
|
-
|
69
|
-
display: true,
|
70
|
-
classes: classNames.enter,
|
71
|
-
currentDuration,
|
86
|
+
animating: false,
|
72
87
|
});
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
this.transitionEnded = false;
|
78
|
-
appLog.info(`transition component enter transitionEnded false`);
|
79
|
-
this.setData({ classes: classNames['enter-to'] });
|
80
|
-
resolve();
|
81
|
-
});
|
82
|
-
});
|
83
|
-
});
|
88
|
+
this.checkShowStatus();
|
89
|
+
}, currentDuration + 20);
|
90
|
+
resolve();
|
91
|
+
}));
|
84
92
|
this.enterFinishedPromise.catch(err => {
|
85
93
|
this.enterFinishedPromise = null;
|
86
|
-
|
94
|
+
this.setData({ animating: false });
|
87
95
|
console.log(err, '---error-enter');
|
96
|
+
this.$emit('enter-error', err);
|
88
97
|
});
|
89
98
|
},
|
90
99
|
leave() {
|
91
|
-
|
92
|
-
|
93
|
-
appLog.info(`transition component leave success`);
|
94
|
-
this.enterFinishedPromise
|
95
|
-
.then(() => {
|
96
|
-
if (!this.data.display) {
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
101
|
+
if (!this.enterFinishedPromise || this.data.animating)
|
97
102
|
return;
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
this.
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
103
|
+
this.setData({
|
104
|
+
animating: true,
|
105
|
+
status: 'leave',
|
106
|
+
});
|
107
|
+
this.enterFinishedPromise
|
108
|
+
.then(() => __awaiter(this, void 0, void 0, function* () {
|
109
|
+
const { duration, name } = this.data;
|
110
|
+
const classNames = getClassNames(name);
|
111
|
+
const currentDuration = isObj(duration) ? duration.leave : duration;
|
112
|
+
this.$emit('before-leave');
|
113
|
+
yield requestAnimationFrame();
|
108
114
|
this.$emit('leave');
|
109
115
|
this.setData({
|
110
116
|
classes: classNames.leave,
|
111
117
|
currentDuration,
|
112
118
|
});
|
113
|
-
requestAnimationFrame(
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
this.
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
});
|
119
|
+
yield requestAnimationFrame();
|
120
|
+
this.transitionEnded = false;
|
121
|
+
clearTimeout(this.timer);
|
122
|
+
setTimeout(() => {
|
123
|
+
this.enterFinishedPromise = null;
|
124
|
+
this.$emit(`after-leave`);
|
125
|
+
this.setData({
|
126
|
+
display: false,
|
127
|
+
animating: false,
|
128
|
+
});
|
129
|
+
this.checkShowStatus();
|
130
|
+
}, currentDuration + 20);
|
131
|
+
this.setData({ classes: classNames['leave-to'] });
|
132
|
+
}))
|
133
|
+
.catch(err => {
|
134
|
+
this.enterFinishedPromise = null;
|
135
|
+
this.setData({ animating: false });
|
136
|
+
console.log(err, '---error-leave');
|
137
|
+
this.$emit('leave-error', err);
|
126
138
|
});
|
127
|
-
})
|
128
|
-
.catch(err => {
|
129
|
-
this.enterFinishedPromise = null;
|
130
|
-
appLog.info(`leave enterFinishedPromise catch`, err);
|
131
|
-
console.log(err, '---error-enter');
|
132
139
|
});
|
133
140
|
},
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
appLog.info(`transition component onTransitionEnd ${this.status} success`);
|
143
|
-
const { show, display } = this.data;
|
144
|
-
if (!show && display) {
|
145
|
-
this.setData({ display: false });
|
146
|
-
}
|
141
|
+
checkShowStatus() {
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
143
|
+
const { status, show } = this.data;
|
144
|
+
yield requestAnimationFrame();
|
145
|
+
if ((status === 'enter' && show) || (status === 'leave' && !show))
|
146
|
+
return;
|
147
|
+
show ? this.enter() : this.leave();
|
148
|
+
});
|
147
149
|
},
|
148
150
|
},
|
149
151
|
});
|
package/dist/popover/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
@import '../common/index.css';.smart-popover{--overlay-background-color:transparent;position:relative}.smart-popover,.smart-popover-button{display:inline-block}.smart-popover-overlay{background-color:var(--popover-background-color,var(--app-B4,#fff));border-radius:var(--popover-border-radius,12px);box-shadow:var(--popover-box-shadow,0 6px 12px 0 rgba(0,0,0,.1));padding:var(--popover-padding,12px);position:absolute;z-index:102}.smart-popover-overlay-arrow{background-position:50%;background-repeat:no-repeat;position:absolute}
|
1
|
+
@import '../common/index.css';.smart-popover{--overlay-background-color:transparent;position:relative}.smart-popover,.smart-popover-button{display:inline-block}.smart-popover-overlay{background-color:var(--popover-background-color,var(--app-B4,#fff));border-radius:var(--popover-border-radius,12px);box-shadow:var(--popover-box-shadow,0 6px 12px 0 rgba(0,0,0,.1));opacity:0;padding:var(--popover-padding,12px);position:absolute;transition:opacity .3s ease-in-out;z-index:102}.smart-popover-overlay-arrow{background-position:50%;background-repeat:no-repeat;position:absolute}
|
package/dist/popover/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
/* eslint-disable prefer-destructuring */
|
2
2
|
import { SmartComponent } from '../common/component';
|
3
|
-
import { transition } from '../mixins/transition';
|
4
3
|
const IconSrc = (deg) => `<svg style="transform: rotate(${deg})" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18.00000052453666" height="6.000001573609978" viewBox="0 0 18.00000052453666 6.000001573609978"><g transform="matrix(-1,-8.742277657347586e-8,-8.742277657347586e-8,1,36.00000104907346,0.0000015736100241790166)"><path d="M18.026037824536658,0.006179333609978323C18.827028524536658,0.014487173609978322,19.72353052453666,0.026256673609978323,20.50303052453666,0.3038745736099783C21.34506052453666,0.6038775736099783,21.90250052453666,1.1284215736099783,22.46337052453666,1.7457315736099783C22.867160524536658,2.1897415736099783,23.66033052453666,3.137051573609978,24.04654052453666,3.5944415736099784C24.36263052453666,3.9694415736099784,24.98139052453666,4.710681573609978,25.31923052453666,5.0693015736099785C25.74452052453666,5.520461573609978,26.270210524536658,6.000001573609978,27.00036052453666,6.000001573609978C27.730510524536662,6.000001573609978,28.25600052453666,5.520461573609978,28.681000524536657,5.069761573609978C29.01880052453666,4.711371573609978,29.63760052453666,3.969671573609978,29.95390052453666,3.5949015736099783C30.33970052453666,3.137511573609978,31.13280052453666,2.1902015736099782,31.53690052453666,1.7461915736099782C32.09870052453666,1.1288815736099784,32.65520052453666,0.6043385736099783,33.49700052453666,0.3043355736099783C34.276700524536665,0.027410573609978322,35.17340052453666,0.014948673609978322,35.97390052453666,0.006640913609978322C36.811100524536656,-0.0018975863900216774,17.189137524536658,-0.0023591663900216775,18.026037824536658,0.006179333609978323Z" fill-rule="evenodd" fill="#FFFFFF" fill-opacity="1"/></g></svg>`;
|
5
4
|
function createSvgIcon(svg) {
|
6
5
|
return `data:image/svg+xml,${encodeURIComponent(`<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">${svg}`)}`;
|
@@ -15,7 +14,6 @@ SmartComponent({
|
|
15
14
|
'leave-to-class',
|
16
15
|
'close-icon-class',
|
17
16
|
],
|
18
|
-
mixins: [transition(false)],
|
19
17
|
props: {
|
20
18
|
// `top`、`topLeft`、`topRight`、`bottom`、`bottomLeft`、`bottomRight`、`left`、`leftTop`、`leftBottom`、`right`、`rightTop`、`rightBottom`
|
21
19
|
placement: {
|
@@ -26,9 +24,12 @@ SmartComponent({
|
|
26
24
|
type: Boolean,
|
27
25
|
observer(value) {
|
28
26
|
if (value !== this.data.currentShow) {
|
29
|
-
|
30
|
-
|
31
|
-
}
|
27
|
+
if (value) {
|
28
|
+
this.onOpen();
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
this.onClose();
|
32
|
+
}
|
32
33
|
}
|
33
34
|
},
|
34
35
|
},
|
@@ -42,10 +43,10 @@ SmartComponent({
|
|
42
43
|
},
|
43
44
|
duration: {
|
44
45
|
type: Number,
|
45
|
-
value:
|
46
|
+
value: 20000,
|
46
47
|
},
|
47
48
|
},
|
48
|
-
data: { currentShow: false },
|
49
|
+
data: { currentShow: false, showStyle: '' },
|
49
50
|
mounted() { },
|
50
51
|
created() { },
|
51
52
|
methods: {
|
@@ -157,10 +158,18 @@ SmartComponent({
|
|
157
158
|
this.setData(params);
|
158
159
|
},
|
159
160
|
onClick() {
|
161
|
+
this.onOpen();
|
162
|
+
},
|
163
|
+
onOpen() {
|
160
164
|
this.getButtonPosition();
|
161
165
|
this.setData({
|
162
166
|
currentShow: true,
|
163
167
|
});
|
168
|
+
setTimeout(() => {
|
169
|
+
this.setData({
|
170
|
+
showStyle: 'opacity: 1;',
|
171
|
+
});
|
172
|
+
}, 100);
|
164
173
|
this.$emit('show-change', true);
|
165
174
|
if (this.data.duration) {
|
166
175
|
setTimeout(() => {
|
@@ -170,10 +179,15 @@ SmartComponent({
|
|
170
179
|
},
|
171
180
|
onClose() {
|
172
181
|
this.setData({
|
173
|
-
|
182
|
+
showStyle: 'opacity: 0;',
|
174
183
|
});
|
175
|
-
|
176
|
-
|
184
|
+
setTimeout(() => {
|
185
|
+
this.setData({
|
186
|
+
currentShow: false,
|
187
|
+
});
|
188
|
+
this.$emit('show-change', false);
|
189
|
+
this.$emit('close', false);
|
190
|
+
}, 300);
|
177
191
|
},
|
178
192
|
},
|
179
193
|
});
|
package/dist/popover/index.json
CHANGED
package/dist/popover/index.wxml
CHANGED
@@ -12,14 +12,12 @@
|
|
12
12
|
|
13
13
|
</smart-overlay>
|
14
14
|
|
15
|
-
<view class="smart-popover-button"
|
15
|
+
<view class="smart-popover-button" catch:tap="onClick">
|
16
16
|
<slot />
|
17
|
-
<smart-
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
</view>
|
22
|
-
</smart-transition>
|
17
|
+
<view wx:if="{{currentShow}}" class="smart-popover-overlay" style="left: {{left}};top: {{top}}; bottom:{{bottom}};right:{{right}}; transform:{{transform}}; {{customStyle}}; {{showStyle}}">
|
18
|
+
<slot name="overlay" />
|
19
|
+
<view class="smart-popover-overlay-arrow" style="background-image: url('{{iconSrc}}'); transform: {{iconTransform}}; {{iconPos}}: {{iconPosVal}}px;width: {{iconWidth}};height:{{iconHeight}};background-size: {{iconWidth}} {{iconHeight}};{{iconStyle}}"></view>
|
20
|
+
</view>
|
23
21
|
</view>
|
24
22
|
|
25
23
|
</view>
|
package/dist/popover/index.wxss
CHANGED
@@ -1 +1 @@
|
|
1
|
-
@import '../common/index.wxss';.smart-popover{--overlay-background-color:transparent;position:relative}.smart-popover,.smart-popover-button{display:inline-block}.smart-popover-overlay{background-color:var(--popover-background-color,var(--app-B4,#fff));border-radius:var(--popover-border-radius,12px);box-shadow:var(--popover-box-shadow,0 6px 12px 0 rgba(0,0,0,.1));padding:var(--popover-padding,12px);position:absolute;z-index:102}.smart-popover-overlay-arrow{background-position:50%;background-repeat:no-repeat;position:absolute}
|
1
|
+
@import '../common/index.wxss';.smart-popover{--overlay-background-color:transparent;position:relative}.smart-popover,.smart-popover-button{display:inline-block}.smart-popover-overlay{background-color:var(--popover-background-color,var(--app-B4,#fff));border-radius:var(--popover-border-radius,12px);box-shadow:var(--popover-box-shadow,0 6px 12px 0 rgba(0,0,0,.1));opacity:0;padding:var(--popover-padding,12px);position:absolute;transition:opacity .3s ease-in-out;z-index:102}.smart-popover-overlay-arrow{background-position:50%;background-repeat:no-repeat;position:absolute}
|
package/dist/popup/popup.wxml
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
wx:if="{{ inited }}"
|
5
5
|
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safeTop: safeAreaInsetTop, safeTabBar: safeAreaTabBar }]) }}"
|
6
6
|
style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle, bottomSafeHeight }) }}"
|
7
|
-
bind:transitionend="onTransitionEnd"
|
8
7
|
catch:touchmove="{{ lockScroll ? 'noop' : ''}}"
|
9
8
|
>
|
10
9
|
<slot />
|